pre poulate master record ID on Child record ID within a Wizard component

  • 1
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
Hi Community,

I am using a wizard component with 3 steps. the first and second steps belong to Model-A and the third step belongs to Model-B. Model-A is the Master object and Model-B is the Child object. So by using the Wizard component, i wanted to create both master as well as child records. So on step2, i have a button which will perfom a save action on the Model-A and then navigates to Step3. On Step3 layout i have child object (Model-B) layout. After populating all the details that i wanted, i will save Step3.

So my question is I want to pre-populate the master record name field on the Detail object's layout (i.e. on step 3).
The below screenshot show about the Step-2 with Model-A (Master Object).


The screen Below describes about The Detail object layout.


When i naviagte to Step3 from Step2, I see that the master record is being created. So if the record is created, there should be a way to prepopulate the field info right?

I used a condition on the Detail objects model (Model-B). My condition is



NewSoftwareRequest is Detail Object's model (Model-B in the above explanation) and Request_Form_popup is the master object's model (Model-A in the above explanation).

Can anyone help me on how to prepopulate the Parent ID field with the data captured on the Request Form Name field.

Thanks.
Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Emily Davis

Emily Davis, Employee

  • 3,502 Points 3k badge 2x thumb
Hi, Avinash,
This should be feasible, and I think you're close. Since the field you want to populate on Model-B is a reference field, you want to pass a record Id (not a Name) into the field value. Try changing your condition on Model-B (the NewSoftwareRequest model) to reference theĀ Id field from Model-A (the Request_Form_Popup model).

The above change should link the records together properly. For display purposes, you may want to make sure you include both the Id and Name fields in Model-A, and the Master_Request_Form__c andĀ Master_Request_Form__r.Name fields in Model-B. This should ensure that the field is not only populated correctly, but the reference parent record's Name (rather than Id) display to the user.

Let me know if you still encounter issues or have more questions.
Thanks!
Emily
Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb
Hi Emily,

I was able to figure the issue. Now I am able to populate the Master ID on the Child record.

Thank you for your Inputs.
(Edited)
Photo of Emily Davis

Emily Davis, Employee

  • 3,502 Points 3k badge 2x thumb
Sure, Avinash! I'm glad you figured it out.