Support Article
Unable to localize text on popup when unsaved work is closed
SA-11626
Summary
When user closes an unsaved work object, an Ok/Cancel JS popup is displayed. The text does not get localized even after customizing the OOTB field values such as pyMessageLabel (Field-Value Rule) for "You are about to replace an open work item" validation message popup.
Error Messages
Not Applicable
Steps to Reproduce
1. Save-as the OOTB field values and customize the localized label.
2. Close the unsaved work form to see the Ok/Cancel JS popup.
3. Observe that the text on the popup is not localized.
Root Cause
The issue is due to a misconfiguration of pega_ui_doc isFormDirty method.
Resolution
Apply the following local-change in UserWorkForm, by providing localized messages in WorkformStandard and updating code in pega_ui_doc isFormDirty methods to use these localized messages.
Add the below code UserWorkForm:
<script>
if(!pega.u.d.fieldValuesList) {
pega.u.d.fieldValuesList = new Hashtable();
}
pega.u.d.fieldValuesList.put("REPLACE_WORKITEM_WARNING",'<%=tools.getLocalizedTextForString(".pyMessageLabel","You are about to replace an open work item")%>');
pega.u.d.fieldValuesList.put("PRESS_OK_TO_CONTINUE",'<%=tools.getLocalizedTextForString(".pyMessageLabel","Press OK to continue and lose your changes")%>');
pega.u.d.fieldValuesList.put("PRESS_CANCEL_TO_RETURN",'<%=tools.getLocalizedTextForString(".pyMessageLabel","Press Cancel to return to the modified form")%>');
pega.ui.Doc.prototype.isFormDirty = function(bPromt){
if ((pega.u.d.explorerFormIsDirty() && (!pega.u.d.myDesktop || pega.u.d.myDesktop.gPortalWarnDirty)) || pega.u.d.explorerFormIsBusy()){
var sMsg1 = pega.u.d.fieldValuesList.get("REPLACE_WORKITEM_WARNING");
var sMsg2 = pega.u.d.fieldValuesList.get("PRESS_OK_TO_CONTINUE");
var sMsg3 = pega.u.d.fieldValuesList.get("PRESS_CANCEL_TO_RETURN");
if (arguments.length > 0){
if(bPromt)
return (! confirm(sMsg1+"\n\n"+ sMsg2 +"\n" +sMsg3));
else
return true;
}
else
return (! confirm(sMsg1+"\n\n"+ sMsg2 +"\n" +sMsg3));
}
else return false;
};
</script>
Published July 15, 2015 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.