Apostrophe in the content causing nintex workflow to fail. Web request , rest api

  • 10 April 2018
  • 6 replies
  • 24 views

Badge +3

Need help, i am using web request action and using REST API call to create an item in nintex workflow. 

{
'__metadata' : { 'type' : '{WorkflowVariable:txtListItemEntityTypeFullName}' },
'Title' : '{ItemProperty:Title}',

}

if Title value contains apostrophe  in the content For Ex: Bob's Car,workflow is failing. Please help me to handle ' in the workflow


6 replies

Userlevel 2
Badge +11

Hi Vijay A R‌,

Try to enclose the title propery in the {TextStart} and {TextEnd} text tags:

{TextStart}{ItemProperty:Title}{TextEnd}

This is sometimes also need in for example fn-trim when the string to trim could contain comma's.

Badge +3

{TextStart} and {TextEnd} , what it does? is it Nintex default variable?

Badge +3

I did this in build string action {TextStart}{ItemProperty:Title}{TextEnd}, still my workflow is encoutering in error

Userlevel 2
Badge +11

And if you try one of these:

  1. in stead of using the tags in a build string, use it directly in the rest message. You need to use where you experience the actual string problem. The Build String with these tags will return the same string......These tags are scanned for by the workflow engine, and interpret all characters in between as 1 string, no matter if there are quotes or commas (e.g. if you have a string with a comma, the fn-trim function will see the comma as a separator between 2 function parameters) in there.
  2. replace the single quotes with double quotes: 'Title': "{ItemProperty:Title}"
  3. fn-replace({ItemProperty:Title},',')
  4. use Xml-Encode (or Xml-Decode; I always mix those 2 up)
Badge +3

XmlEncode works for me . Thank you

But any idea how to use nintex inline function ex: XmlEncode in javascript?

Userlevel 2
Badge +11

If you need to encode something in JavaScript then you should use JavaScript functionality for this, which can be found with a simple Google search. If you put your string in double quotes then JS should be able to properly handle apostrophe characters, e.g. var myString = "This is a 'test' text.". URLs can be encoded using encodeURI().

Reply