Hi All,
I am trying to lock fields when the NEXT button in a BPF is clicked, I have used the code below, but i found out it only works when you refresh the form. I tried using the code in an onsave event, but i get the pop up that the form isnt saved and even when i click okay, it clears out the form and when i put the code inside the addOnStageChange event of the BPF, he form gets into a loop. Someone help me out, as this looks petty but yet wouldnt work-
function Lockfields(executionContext) {
var formContext = executionContext.getFormContext();
var appRequest = formContext.getAttribute("approval");
if (appRequest != null) {
if (appRequest.getText() == "draw") {
//lock fields
formContext.getControl("field").setDisabled(true);
formContext.getControl("field").setDisabled(true);
formContext.getControl("field").setDisabled(true);
Xrm.Page.data.save().then(Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId()));
}
}
}
In Between: How do i paste codes on here, since the change of the UI, i cant paste in a code editor?
*This post is locked for comments
I have the same question (0)

Report
All responses (
Answers (