The CreatorCon Call for Content is officially open! Get started here.

Learning#16: Handling special character in API Handling in Flow Designer?

Shamma Negi
Kilo Sage
Kilo Sage

Hi Team,

 

I have found this example very useful where special characters are not allowed in API Handling. How to handle those in Flow Designer Scripting:

 

===================================

var desc = fd_data.trigger.current.description;

var desc1 = desc.replace(/\s+/g, ' ').trim();   //This is to remove extra spaces and new lines.

var desc2 = desc1.replace(/"/g, '\'');  //This is to replace double quote with single quote.

var finalDesc = desc2.replace(/\\/g, '\\\\');  //This is to replace the character \ with \\.

==================================

 

This is useful to remove the special character and replace it with allowed character.

 

Hope this helps.

Please mark this helpful if this helps you.

 

Regards,

Shamma

Regards,Shamma Negi
2 REPLIES 2

Maik Skoddow
Tera Patron
Tera Patron

Hi

sorry, but I'm irritated. You provide the solution but asking how to do it. Maybe the following blog post may help you: https://blog.snowycode.com/post/how-to-script-in-flow-designer-servicenow 

Maik

Just to clarify, I am providing solution as my learnings that is why it starts with learnings#. I will take this input as a feedback and start removing How/What keywords from the questions so that users read it as a learning not questions.

 

Thanks for the feedback.

 

Regards,

Shamma

Regards,Shamma Negi