Hi there,
I am running a plugin pre-validation to prevent an opportunity and contact being created on lead qualification.
To enhance the user experience I am using the below JavaScript to refresh and open the newly created Account record on save.
However, at present nothing happens...I ran a debugger on the click of qualify and I can see the function being hit but executeContext is undefined...therefore it never gets into the rest of the code and fails the first "if".
function RefreshOnQualify(eventContext) {
debugger;
if (eventContext != null && eventContext.getEventArgs() != null) {
if (eventContext.getEventArgs().getSaveMode() == 16) {
setTimeout(function () {
Xrm.Page.data.refresh(false).then(function () {
var accountId = Xrm.Page.getAttribute("parentaccountid").getValue();
if (accountId != null && accountId.length > 0) {
Xrm.Utility.openEntityForm(accountId[0].entityType, accountId[0].id)
}
}, function (error) { console.log(error) });;
}, 3000);
}
}
}
Any help appreciated- Am I doing something very silly?
*This post is locked for comments
I have the same question (0)