Back again with interesting requirements in the PowerApps portal.
Ex. We have an account table, and it has a Primary contact field. In the Advanced form steps, we would like to have the first steps as Create the Account record, select the Primary Contact record, and edit the Primary contact record in the next step and configure the next step to Edit mode in Entity A.
Step 1: Configure the Entity A in Create/Edit mode
Step 2: Configure the Entity B in Edit mode
Step 3: Configure the Entity A in Edit mode
I have searched a lot, but found of couple of places with details. So i thought let write it up in one place. so that it will be easy to refer.
We should have link between the Entity A and Entity B or you should have the GuId of the Entity B stored in the Entity A. So that you can use that details to append it to the next step query string.
Place the following script in the Entity A : Advance form step –>Form options –> Custom JavaScript
$(document).ready(function () {
// Get the guid for enitty b
var primaryContactId = $("#primaryContactId").val();
// Get the content form details
var url = $('#content_form').attr('action');
// append query string
$('#content_form').attr('action', url + '&pcid=' + primaryContactId);
});
Configure the next step for Entity B as below
Set the Record Source –> Query String
Primary Key Query String Parameter name –> pcid ( it should be same as above script) and choose the table name (Contact)
Primary Key Attribute Logical name – choose the unique identified field (contactid)
If you have the next step configured to Entity A, choose Record source –> Result From Previous Step
Entity Source Step – Step 1.
I hope this quick syntax and steps will help you to set up this type of requirement easily.
Please do reach out to me If you need any help or questions.