Pass the value with "\n" in multiline variable if new line in flow action for integration
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2024 07:14 AM
Hello Team,
I am working on one of the integration and user copy and paste some content generated in multiline variable in catalog form, Integration expectation that when we send the payload then for each new line in multiline variable content remove new line and add \n like "test\ncopy\npaste".
Please let me know any solution for this.
Thanks,
Manish
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 06:46 AM
Hello Team,
Could anyone put some light how to achieve this.
Thanks,
Manish
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 01:22 PM
Hello @manish62
You can try the below approach in your flow:
var gr = new GlideRecord("incident");
gr.addQuery("sys_id", "b1827ade977e0e100077f43de053af02");
gr.query();
if (gr.next()) {
var incDesc = gr.getValue("description").trim(); //remove any extra spaces at the start or at the end
}
gs.info(incDesc);
var newDesc = incDesc.replace(/\r?\n/g, "\\n"); //replace with \n
gs.info(newDesc);
(=tested)
Thanks,
Murthy
Murthy