I added a new button inside my "Parcours" form that takes me to another form "Question" with a xrm.navigation.openform
The "Question" form has a lookup field from "Parcours" that I want to populate set automatically from the previous form like this for example :
This is my code for my button, I want to detect the ID of the parcours automaticly and set it in the new "Question" form
function NavigateQuestion(){
var entityFormOptions = {};
entityFormOptions["entityName"] = "zs_question";
var formParameters = {};
// Set lookup column
formParameters["zs_parcours"] = ""; // I want to put the ID here from the previous form.
formParameters["zs_parcoursname"] = ""; // Name of the parcours.
formParameters["zs_parcourstype"] = "zs_parcours"; // Table name.
Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
function (success) {
console.log(success);
console.log(formParameters);
},
function (error) {
console.log(error);
});
}