Flow Designer - REST Step Input Transform Function - JSON format for multi line fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 01:49 PM - edited 09-13-2023 06:11 AM
Hello -
I am working on an outbound REST API integration using a Flow and a Rest Step Action for the first time. In our Description and our Work Notes/Additional Comments fields there would be multiple lines of text. Sent via the API as-is, we get a "Unable to parse the JSON" error response back from the endpoint we are calling. This is expected as we are just sending the string content right over and it contains carriage returns for the multiple lines.
I am trying to find the best way, and not sure if it is even possible, to replace these carriage returns with something JSON friendly like /n or something like that. I was wondering if this is something I should be able to achieve with a Transform Function on the Input variables that we are using in the Rest Step, I did try something like this, but couldn't ever get it to work, it would just add the "/n" at the end of each line in the Description field. I was wondering if there was a way to achieve this within the Transform functions, or some other way within Flow Designer.
Or is this something I would need to write a script for within the Input variables for the Rest step Action?
This is what I am trying to accomplish, systematically:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0549983
Thanks!!