Description:
If information pulled from another location, such as Service Desk contains a special character and is handled in a Pre or Post execution code script PAM will interpret the character as is and will cause an error to occur similar to:
Error Message: org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference
Solution:
This is because PAM is not encoding the special characters in anyway and they must be encoded prior to use in a similar way to the following examples:
Process.outputString = Process.inputString.replace(/&/g, "&"); Process.outputString = Process.outputString.replace(/</g, "<"); Process.outputString = Process.outputString.replace (/>/g, ">"); Process.outputString = Process.outputString.replace (/"/g, """); Process.outputString = Process.outputString.replace (/'/g, "'"); 21104545-1=
Please note, inputString and outputString are arbitrary names, and this does not need to be a process level variable. This will replace "< , > , &", etc with the proper entity reference for each character. For example, & becomes & and < becomes <.