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

Ampersand character lost if passed at end of parameter chain

SA-15541

Summary



A configuration is created to call a Flow with an associated parameter.



If the parameter has ampersand character at the end of the parameter chain (“MyBusiness & Co&”), then the character gets truncated (“MyBusiness & Co”).

 


Error Messages



Not Applicable
 


Steps to Reproduce


 
  1. Create a Flow with an incoming parameter
  2. Create a button with “Create Work” action
  3. Call created Flow and pass the parameter with an ampersand ‘&’ at the end. The last ampersand character will be truncated


Root Cause



The ampersand character is usually used to separate parameters on request to the server so the system will consider this ampersand as a separator.

Resolution



Implement a local-change. A new version of the JavaScript function called createNewWork is incorporated into FRAGMENT UserWorkForm:

<script>
pega.desktop.createNewWork = function(strClassName, harnessVersion, strFlowName, flowParams,contentID, dynamicContainerID,actionRequestID, skipConflictCheck) {
 var args = arguments[0];
 if (typeof args == "object" && args.name == "safeURL") {
 var oSafeURL = SafeURL_clone(args);
 var strClassName = oSafeURL.get("className");
 var strFlowName = oSafeURL.get("flowType");
 var harnessVersion = oSafeURL.get("HarnessVersion");
 var contentID = oSafeURL.get("contentID");
 var dynamicContainerID = oSafeURL.get("dynamicContainerID");
 var actionRequestID = oSafeURL.get("actionRequestID");
 
 }
 
 
 if (!oSafeURL) {
 var oSafeURL= new SafeURL();
 }
 var sourceString= "";
 if (strClassName && strClassName != "" ) {
 oSafeURL.put("param", strClassName);
 }
 if (harnessVersion && harnessVersion != "" ) {
 oSafeURL.put("version", harnessVersion);
 }
 if(contentID && contentID !="")
 oSafeURL.put("contentID",contentID);
 if (dynamicContainerID && dynamicContainerID != "" ) {
 oSafeURL.put("dynamicContainerID", dynamicContainerID );
 }
 if (actionRequestID && actionRequestID != "" ) {
 oSafeURL.put("pzActionID", actionRequestID );
 }
 
 if (strFlowName && strFlowName != "" ) {
 oSafeURL.put("FlowType", strFlowName);
 // 09/27/2012 TASK-118705 GUJAS1 Add flow parameters to the safe URL.
          var paramKeys= "";
 if (flowParams && flowParams != '') {
 // At this point, each parameter is encoded,
 //the complete string can be split on '&'
 var oParams = flowParams.split("&");
 for (var i=0;i<oParams.length; i++) {
 if (oParams[i] != '') {
 var oParamNMPair = oParams[i].split("=");
 // Unescaping first will convert the %2B to + which will be replaced by space.
 //Avoid this by replacing the + with space and then unescaping
 /* Unescape is deprecated, so changed it with decodeURIComponent : kumad1 */
          oParamNMPair[1] = oParamNMPair[1].replace(/%26/g,"!~#");
 oSafeURL.put(oParamNMPair[0],decodeURIComponent(oParamNMPair[1].replace(/\+/g, " ")).replace(/!~#/g,"%26") );
          paramKeys += oParamNMPair[0] + "&";
 }
 }
//Adding a paramKey string to be split at server-side, so that RecentGadget can have the custom parameters also. JAINB1- BUG-129094.
          paramKeys = paramKeys.substring(0, paramKeys.lastIndexOf("&"));
          if(paramKeys != "" || paramKeys != null){
          oSafeURL.put("flowParamNames", paramKeys);
          }
 }
 
 // TASK-149427: GUJAS1 If skipConflictCheck has been specified, put in in the parameters.
 if(skipConflictCheck != null ){
 oSafeURL.put("SkipConflictCheck", skipConflictCheck);
 }
 
 if (!pega.desktop.support.openSpace("Work", oSafeURL , "EnterNewWorkFromFlow")) {
 sourceString= oSafeURL.toQueryString();
 var strURL= pega.desktop.support.constructUrl(sourceString , "EnterNewWorkFromFlow");
 pega.desktop.openUrlInWindow(strURL, "pyWorkPage", WorkFormSize + PopupWindowFeatures);
 }
 }
 else {
 if (!openSpace("Work", oSafeURL , "EnterNewWork")) {
 sourceString= oSafeURL.toQueryString();
 var strURL= pega.desktop.support.constructUrl(sourceString , "EnterNewWork");
 pega.desktop.openUrlInWindow(strURL, "pyWorkPage", WorkFormSize + PopupWindowFeatures);
 }
 }
}
</script>
 
BUG-219306 has also been created to review and address this issue in a future release.

Published January 31, 2016 - Updated October 8, 2020

Was this useful?

0% 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