Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Validation error message displays property names

SA-38843

Summary



Validation error message displays with property names of the fields that caused the validation error.


Error Messages



Not Applicable


Steps to Reproduce



1. Provide an incorrect value into any field with a validation.
2. Click Submit


Root Cause



This is working as designed. By default, Pega includes the property name of the field that the validation error occurred.




Resolution



Pega offers the capability to customize the display of an error section through the following steps:.
  1. Create a custom custom error section.
  2. Select the Display options tab in the harness rule and add the custom error section.




Alternatively, to simply remove the property name from the error messages, the HTML below can be used in your own custom error section:


<pega:save name="insHandle" ref="$stream-handle"/>
<pega:save name="key" ref="$stream-definition(pxObjClass)=$stream-definition(pyClassName).$stream-definition(pyStreamName)"/>
<pega:save name="methodStatus" ref="$stream-definition(pyMethodStatus)"/>
<pega:save name="objClass" ref="$stream-definition(pxObjClass)"/>
<pega:include name="ShowMe-HarnessInsert"/>
<%

java.util.Map errorMap = null;
if ("true".equals(tools.getParamValue("TopLevelPageErrors"))) {
errorMap=tools.getPrimaryPage().getTopLevelPage().getMessagesMapByEntryHandle();
} else {
errorMap=tools.getPrimaryPage().getMessagesMapByEntryHandle();
}
if(errorMap != null){
java.util.Iterator iter_errorMap = errorMap.keySet().iterator();
tools.appendString("<ul class='pageErrorList layout-noheader-errors'>");
while(iter_errorMap.hasNext()){
String strKey = (String)iter_errorMap.next();
String strValue = (String)errorMap.get(strKey);
if(!strKey.equals("") ){
// This condition is to filter the error message and show pzShowConflict section in case of work-object parallel update(conflict)
if(!strKey.endsWith("$ppyCaseUpdateInfo$ppyNewMessage")){

// BUG-201159removed errorText as it is confgured in various application skins
tools.appendString("<li style='color:inherit'>");

ClipboardProperty cp = tools.getIfPresent(strKey);
String strPropertyLabel = tools.getLocalizedTextForString("pyMessageLabel" ,tools.getDictionary().fromDefinition(cp,"pyLabel"));
String sHideMessageKey = tools.getParamValue("HideMessageKey");
if("false".equals(sHideMessageKey) || "".equals(sHideMessageKey)) {
tools.appendString("");
}
tools.appendString(StringUtils.crossScriptingFilter(strValue)+"</li>");
}
}
else{

//String errorMessages[] = strValue.split("\\*\\*");
// Bug-30483 : Changed the delemeter to new line
String errorMessages[] = strValue.split("\n");
for(int i=0; i<errorMessages.length; i++){
if(!errorMessages[i].trim().equals("")){
//BUG-201159 removed errorText as it is confgured in various application skins
tools.appendString("<li style='color:inherit'>" + StringUtils.crossScriptingFilter(errorMessages[i]) + "</li>");
}
}
}
}
tools.appendString("</ul>");
}

%>


NOTE: By default, Pega uses the section - ErrorList, to display the error messages. The HTML code above is the same used in ErrorList, just with edits to remove the property name from the error.

Published July 13, 2017 - Updated October 8, 2020

Was this useful?

42.857142857143% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us