Special Characters in Process Automation

Document ID : KB000028797
Last Modified Date : 11/04/2018
Show Technical Document Details
Introduction:

If CA PAM (Process Automation) is manipulating special characters, either in javascript operators, or in pre / post execution the character will be taken as code and will cause different problems, from the character being dropped, to code not executing correctly.

Process Automation is essentially a development tool.  As such one can have strings that need to be interpreted by Perl, Javascript, Windows Shell, Unix Shell, Web Service calls, Powershell, etc. etc.  You may want to pass special characters to any of these in order to perform language specific functions or you may want to pass static strings.

Just like other general purpose development tools Process Automation cannot predetermine the purpose of your string.  That is why all of these languages/APIs have functionality, not all of them the same, to indicate a string is a "static" string and a way to escape special characters.

The need to encode the string or not needs to be explicitly defined and can only be determined with an full understanding of the activities being programmed into a PAM Process.

This is not PAM specific functionality, this is standardized technology which is being leveraged by Process Automation.

For example, using JavaScript, when you do something like Process.inpString.toUpper() you aren’t really telling “PAM” to convert the string to all uppercase.   You are calling a JS function that converts a string to uppercase. 

This is important because we simply can not document and convey all possible functionality of all possible function calls that can be leveraged from within PAM and expect a certain level of understanding of the language being used. 

You could specifically tell PAM to replace special characters explicitly:

Process.outputString = Process.inputString.replace(/&/g, "&");
Process.outputString = Process.inputString.replace(/</g, "&lt;");
Process.outputString = Process.inputString.replace (/>/g, "&gt;");
Process.outputString = Process.inputString.replace (/"/g, "&quot;");
Process.outputString = Process.inputString.replace (/&apos;/g, "&apos;");

Or in JavaScript the encoding can be done by using the .encodeURI() function versus the individual replace function listed above.

This can be used in place of the multiple .replace statements, where instead of telling PAM to encode each specific character, possibly requiring many lines of replace statements, you are telling PAM to encode the entire string with a single line.

Please see http://www.w3schools.com/jsref/jsref_encodeuri.asp for more information.

Both are legitimate ways to address issues with special character and it is likely both the .encodeURI and the .replace JavaScript functions have their place and usage depending on the requirements of a particular process design. 

Instructions:
Please Update This Required Field