Hello,
i am creating a model driven app and I want to pass a value form the main form to the quick create form. This value is really just the selected field the main form is currently showing.
I have tried executionContext.setSharedVariable on the main form and am trying to pass this via formContext.ui.setFormNotification to test if it is working, but the notification is empty (the notification appears when i pass a given string). Below is my code:
The first thing I would look for is to make the mapping between the parent table (main form) and the Child entity (quick creation form) so that the values can be passed automatically.
In case this does not solve the entire scenario, I would use code and you can do it this way
https://learn.microsoft.com/en-us/power-apps/maker/data-platform/map-entity-fields
function ObtenerCorreo(e) {
debugger;
// Get the Form Context
var formContext = e.getFormContext();
// Set variables for the related entity to get data from
try{var recordGuid = formContext.getAttribute("jm_profesor").getValue()[0].id; }
catch(err) {}
// If the recordGuid contains data
if (recordGuid != null) {
// Use the WebApi to get data
Xrm.WebApi.retrieveRecord("jm_profesor", recordGuid, "?$select=jm_nombre,jm_correoelectronico").then(
// If successful, set variables for the results
function success(result) {
var CorreoElectronico = result.jm_correoelectronico;
// Set the form fields
formContext.getAttribute("emailaddress").setValue(CorreoElectronico);
},
// If there's an error in the WebApi call, log the error and alert the user
function (error) {
console.log(error.message);
// handle error conditions
var errorMessage = 'Error: An error occurred in the GetRelatedInfo function: ' + error.message;
var alertStrings = { confirmButtonLabel: "Yes", text: errorMessage };
var alertOptions = { height: 120, width: 260 };
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
function success(result) {
console.log("Alert dialog closed");
},
function (error) {
console.log(error.message);
}
);
}
);
}
}
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
You can accept more than one post as a solution
Hello,
I might be wrong but setSharedVariable i used to pass the data within events on the same form. Is there a chance you can use mapping to pass that data between forms? https://learn.microsoft.com/en-us/power-apps/maker/data-platform/map-entity-fields
mmbr1606
22
Super User 2025 Season 1
stampcoin
17
ankit_singhal
11
Super User 2025 Season 1