Skip to main content
Nintex Community Menu Bar

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

  • April 10, 2018
  • 6 replies
  • 57 views

Forum|alt.badge.img+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

Forum|alt.badge.img+11
  • Nintex Partner
  • April 10, 2018

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.


Forum|alt.badge.img+3
  • Author
  • April 10, 2018

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


Forum|alt.badge.img+3
  • Author
  • April 10, 2018

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


Forum|alt.badge.img+11
  • Nintex Partner
  • April 10, 2018

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)

Forum|alt.badge.img+3
  • Author
  • April 10, 2018

XmlEncode works for me . Thank you

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


Forum|alt.badge.img+11
  • Nintex Partner
  • April 11, 2018

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().