Here’s a quick tip for scripting, and possibly a quick resolution whenever you encounter an ampersand XML parsing error within SuiteScript.
We will use this email as an example when a script that had been running for many months without any issues. And basically, the main part of the error is here, error parsing XML, the incident name must immediately follow the ampersand in the entity reference.
And basically what this means is that somewhere in your script, there’s an ampersand that shouldn’t be there. Using the example, what happened was somebody introduced an ampersand (&) into someone’s job title which caused this XML parsing error to happen.
So there are two quick fixes for this ampersand XML parsing error:
- Either you can go into all the records that are referencing here in this script, and remove the ampersand or
- Fix the error using code.
Good to know: How long does it take to implement NetSuite?
If we go and look at the code basically, there is an XML.escape function within the code that will actually do the lookup on the field to enter the field. And so it knows what to do with the ampersand at that point in the XML. So that’ll actually come out and print the XML and the email. That’s what the script was doing, it’s actually sending the email out for payroll information. And that’s it.