Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Pass Parent Form Record ID to Iframe Form in nuBuilder

Questions related to using nuBuilder Forte.
Post Reply
yvesf
Posts: 337
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 92 times
Been thanked: 11 times

Pass Parent Form Record ID to Iframe Form in nuBuilder

Unread post by yvesf »

hello,


I have a Patients form, which includes an iframe that loads the Consultation form in edit mode.

I want to automatically set the cs_patient_id field in the Consultation form to the current patients_id from the parent form.

To find how the patient ID is passed, I used nuDebug(nuHash()) in the Before Edit event of the Consultation form and saw that the correct value is stored in the record_id cookie.

So, I wrote a procedure that retrieves record_id and uses nuJavaScriptCallback() to set the cs_patient_id. This script is triggered in the onnuload event of the cs_patient_id field.

But instead of getting the patient ID, the value becomes -1. When I try using RECORD_ID, I get the procedure name instead.

I'm stuck and can't figure out how to properly assign the patient ID to cs_patient_id.

Attached a simple example of what I am trying to achieve : pass the record id of the parent form to level below.
2025-04-12_204157_67fade257d779_nuBuilder_backup.zip
Any help would be greatly appreciated!

Yves

An alternative would be to create an hidden display field retrieving the record_id of the patient for that but as we have the hash cookie, it would be nicer to retrieve it via the right formula. In any case, I would like to know the best practice for this kind of pb
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: Pass Parent Form Record ID to Iframe Form in nuBuilder

Unread post by kev1n »

Hi Yves,

Since the procedure is executed from within the iframe—which contains a new, unsaved record—the record ID returned will be -1.

An easier approach would be:

Code: Select all

nuGetLookupId(parent.nuRecordId(),'vs_patient_id');
and to set the Slot datetime, use

Code: Select all

nuSetValue(this.id, nuCurrentDateTime());
Post Reply