Hi,
I have the following JS code
function getFormRedirectAttribute(formContext,formRedirect){ alert(formRedirect); //parameter string }
This is called via form OnLoad Event. This returns a parameter string I've included in the form event. I've confirmed this returns the parameter string in an alert message when the form loads (formRedirect).
I then have the following command bar button code which should execute the function above when dialog is confirmed (getFormRedirectAttribute). The expected result is to return the parameter string as an alert exactly like it does on form load, however the alert string always returns "Undefined" when called via the button. I'm not sure why?
function buttonRequestAccessRecord(formContext) { var confirmStrings = { text:"Run function", title:"Confirmation Dialog" }; var confirmOptions = { height: 200, width: 450 }; Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then( function (success) { if (success.confirmed) getFormRedirectAttribute(); else getFormRedirectAttribute(); }); }
Any help is massively appreciated!
Many thanks