Learning#16: Handling special character in API Handling in Flow Designer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 03:57 AM - edited 08-07-2023 12:44 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2023 11:58 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 12:41 AM
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