Hi,
I am using form control on an application form that includes two tabs: Technical and Business.
Each tab uses form control to display its respective data. I need to display different messages to the user based on the status of the form: If the status is Draft, the message should read: “Update Status Reason to Complete to lock the record and submit for review.” If the status is Complete, the message should read: “Update Status Reason to Draft to unlock the record for modifications.”
I called a function on the OnChange event of the status field on both the Technical and Business forms, and the notification message was displayed correctly.
However, when I called the same function on the TabStateChange event for the Technical and Business tabs on the application form, the message did not refresh.
I suspect the issue may be related to refreshing the form used in the form control.
I attempted to resolve this by trying another function (as suggested in the second blog), but the message still does not refresh when the TabStateChange event occurs.
Could you please advise on how to ensure the message refreshes correctly when the TabStateChange event is triggered? Thank you, Siva
function throwCustomMessage(statuscodeControl, statusReason) {
var customStatusChangeMessage = “customStatusChangeMessage”;
let ifComplete = parent.Xrm.Utility.getResourceString(“apms_resx/messages”, “IfComplete_CustomMessage”);
let ifDraft = parent.Xrm.Utility.getResourceString(“apms_resx/messages”, “IfDraft_CustomMessage”);
if (statusReason == 1 && statuscodeControl != null && !statuscodeControl.getDisabled()) {
Xrm.Page.ui.setFormNotification(ifDraft, “INFO”, customStatusChangeMessage);
} else if (statusReason != 1 && statuscodeControl != null && !statuscodeControl.getDisabled()) {
Xrm.Page.ui.setFormNotification(ifComplete, “INFO”, customStatusChangeMessage);
} else { Xrm.Page.ui.clearFormNotification(customStatusChangeMessage); }
}
Second block:
if (statusReason == 1 && statuscodeControl != null && !statuscodeControl.getDisabled()) {
formContext.getControl(entityName).ui.setFormNotification(ifDraft, “INFO”, customStatusChangeMessage); }
else if (statusReason != 1 && statuscodeControl != null && !statuscodeControl.getDisabled()) {
formContext.getControl(entityName).ui.setFormNotification(ifComplete, “INFO”, customStatusChangeMessage); }
else { formContext.getControl(entityName).ui.clearFormNotification(customStatusChangeMessage);
}