as MS will deprecated Xrm.Page.context.getQueryStringParameters, i am trying to switch it to formContext.data.attributes as MS suggested. but after doing the following, i am not able to get the passed parameter:
1. add the parameter to the form property
2. js code open form with this parameter value passed:
var entityFormOptions = {};
entityFormOptions["entityName"] = "new_privatesalenotice";
var formParameters = {};
formParameters["new_bypassprivatesalenoticereason"] = "test";
// Open the form.
Xrm.Navigation.openForm(entityFormOptions, formParameters);
3. read value on form load:
var onLoad = function (executionContext) {
var formContext = executionContext.getFormContext();
if (formContext.data.attributes.get("new_bypassprivatesalenoticereason") !== null) // sample code for getting non-entity bound data
{
Xrm.Navigation.openAlertDialog({ text: formContext.data.attributes.get("new_bypassprivatesalenoticereason").getValue() }); // This will show the alert "Test parameter value"
}};
but i am getting formContext.data.attributes null error.
anyone has an idea? thanks a lot!