- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2023 05:15 AM
I have description field in Snow as -
I am using BR for integration as -
var description=current.description;
var json = new global.JSON();
description = json.encode(description);
sm.setStringParameterNoEscape("description", description);
The value is not getting updated to Jira Description field, it is updated as blank.
The above code works fine for single line text but not for multiLine text. How to map MultiLine description field ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2023 07:25 AM - edited ‎07-28-2023 07:28 AM
@surbhi_123 My REST API call was perfectly working fine when the description had a single line, it failed when there were multiple lines.
I have modified my script as below and the REST API call started working fine
var desc_split=inc_rec.description.split('\r\n');
r.setStringParameterNoEscape('description',desc_split.join('\\r\\n'));
This is my entire script to trigger the REST call, where the queried incident has multiple lines in my description.
try {
var inc_rec=new GlideRecord('incident');
inc_rec.addQuery('number','INC0010146');
inc_rec.query();
inc_rec.next();
var r = new sn_ws.RESTMessageV2('VK REST API', 'Create Incident');
var desc_split=inc_rec.description.split('\r\n');
r.setStringParameterNoEscape('description',desc_split.join('\\r\\n'));
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.info(responseBody);
}
catch(ex) {
var message = ex.message;
}
Please mark the appropriate response as correct answer and helpful.
Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2023 07:25 AM - edited ‎07-28-2023 07:28 AM
@surbhi_123 My REST API call was perfectly working fine when the description had a single line, it failed when there were multiple lines.
I have modified my script as below and the REST API call started working fine
var desc_split=inc_rec.description.split('\r\n');
r.setStringParameterNoEscape('description',desc_split.join('\\r\\n'));
This is my entire script to trigger the REST call, where the queried incident has multiple lines in my description.
try {
var inc_rec=new GlideRecord('incident');
inc_rec.addQuery('number','INC0010146');
inc_rec.query();
inc_rec.next();
var r = new sn_ws.RESTMessageV2('VK REST API', 'Create Incident');
var desc_split=inc_rec.description.split('\r\n');
r.setStringParameterNoEscape('description',desc_split.join('\\r\\n'));
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.info(responseBody);
}
catch(ex) {
var message = ex.message;
}
Please mark the appropriate response as correct answer and helpful.
Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2023 02:38 AM
It still sends invalid json format. The log value sent is -
"description": {
"type": "doc",
"version": 1,
"content": [{
"type": "paragraph",
"content": [{
"type": "text",
"text": "Requested For = Shalika Sinha
Short Description = jk
More details about the issue = jb
"
}]
}]
},