In rest-message getting {"detail":"JSON parse error - Invalid \\escape: line 11 column 31 (char 359)\nPossible cause: trailing comma."}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-16-2022 06:58 AM
Hi,
I need to pass the share path through rest message. But I'm getting this error {"detail":"JSON parse error - Invalid \\escape: line 7 column 33 (char 244)\nPossible cause: trailing comma."}
var i = new GlideAggregate('sys_user');
var m = '';
var n='';
var x = mr();
var j = '';
var x = current.variable_pool.select_users_groups.getDisplayValue();
if (x == 'Group') {
j = current.variables.please_enter_the_dl_group_name.u_cn.getDisplayValue();
} else {
j = names();
}
function names() {
var j = [];
var i = new GlideRecord('sys_user');
i.addQuery('sys_id', 'IN', current.variables.username);
i.query();
while (i.next()) {
//j.push(i.email.toString());
j.push(i.u_ea_domain.u_domain.getDisplayValue()+'\\\\'+i.user_name.toString());
}
return j;
}
function mr() {
var mrv;
var itemID = current.sys_id;
var ritmGR = new GlideRecord('sc_req_item');
if (ritmGR.get(itemID)) {
mrv = ritmGR.variables.path;
// gs.addInfoMessage("a=" + mrv);
}
m = mrv.path_1;
}
var gr = new GlideRecord('sc_task');
gr.addEncodedQuery('short_descriptionSTARTSWITHNeed access to storage' +'^parent=' + current.sys_id);
gr.query();
if (gr.next()) {
var number = gr.number;
}
var instanceURL = gs.getProperty('glide.servlet.uri');
var callbackUrl = instanceURL + 'api/now/table/sc_task/' + gr.sys_id;
try {
var r = new sn_ws.RESTMessageV2('Ansible-NetworkShareAccess', 'NetworkShareAccess');
r.setStringParameterNoEscape('callbackUrl', callbackUrl);
r.setStringParameterNoEscape('ticketNumber',number);
r.setStringParameterNoEscape('sysId', gr.sys_id);
r.setStringParameterNoEscape('sn_sharePaths', m);
r.setStringParameterNoEscape('sn_principalType', current.variable_pool.select_users_groups.getDisplayValue());
r.setStringParameterNoEscape('sn_principal', j);
r.setStringParameterNoEscape('sn_permissionType', current.variable_pool.please_select_the_type_of_access.getDisplayValue());
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
} catch (ex) {
var message = ex.message;
}
Can anyone help me on this.
Thanks,
Sowmya
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-16-2022 07:40 AM
Your issue is still the same as when you posted this same question yesterday. You need to escape the backslashes in sn_sharePaths since "\a" is not a valid escape character.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-16-2022 08:06 AM