How to identify /n from a string and set its value in next line
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 06:30 AM
HI All,
I have a string which is supposed to be identified with /n for next line and set the value in Incident Description field accordingly.
Example:
This is servicenow new version release \n please go through wiki for more details \n Contact support team for any issues \n Thanks
I want to set above in Incident field- description ,in this way where \n is meant for next line.
This is servicenow new version release
please go through wiki for more details
Contact support team for any issues
Thanks
Can Anyone put your thoughts on this or idea how do I proceed through scripting.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 06:34 AM
This works just fine
g_form.setValue('description','This is servicenow new version release \n please go through wiki for more details \n Contact support team for any issues \n ');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 06:35 AM
I believe even the server side using current should work fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 06:45 AM
Sorry forgot to mention.
The string value will be dynamic and has to be retrieved from a field, so have to set the value from that field and set in Description.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 07:09 AM
Should not be a problem.
You can get the value by using
var str = g_form.getValue("FIELD_NAME");
then set it by using
g_form.setValue("short_description",str);
The important thing is that the short_description field is configured as multi line text (Max Length >= 256).
It's not very clear if you have \n or /n in your input string, anyway, in case you have to replace all the occurrences of /n to be \n (the actual new line character), you can use the replace() JavaScript function. So you will have something like:
var str = g_form.getValue("FIELD_NAME");
var strReplaced = str.replace ("/n","\n");
g_form.setValue("short_description",strReplaced);
Regards,
Loris