
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2019 02:16 AM
Hi i have done one integration between two instance (Source and Target instance).
I am facing this issue when i am updating "u_solution" custom field in custom table of the target instance.
I am sending the below data to the target instance.
ab\ghi335r- User has already left the business - no access can be granted
ab\ghi565r- User does not have First Name which is a specific requirement for this request.
ab\ghi015r- User does not have Last Name which is a specific requirement for this request.
Kindly help me on the same.
Regards,
Sirraj
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2019 02:36 AM
Hi Sirraj,
How are you sending the value from 1 instance to another?
are you using REST API?
If yes then how are you setting the string value?
you have backslash in your value are you escaping that
use JSON.stringify() to convert the data before sending
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2019 02:31 AM
Can you share the code? I think error is because of content type. I think you must be using the post method to create a new incident in target instance.
I was able to resolve by using JSON.stringify() to convert the data before sending.
Check out this blog for similar issue and resolution
Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade
Abhishek Gardade

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2019 05:20 AM
Hi Abhishek,
Thank you for the response. I will paste my script include code here.
var Test_Robotic_Automation = Class.create();
Test_Robotic_Automation.prototype = {
initialize: function() {},
getTableDetail: function(current) {
function jsonEncode(str) {
str = new JSON().encode(str);
return str.substring(1, str.length - 1);
}
try{
var r = new sn_ws.RESTMessageV2('Test_Robotic_Automation', 'put');
r.setStringParameterNoEscape('u_comments', 'Comment Success001');
r.setStringParameter('u_solution',jsonEncode(" test update")); // test update should be replaced with the content which i have mentioned above.Those three lines.
r.setStringParameterNoEscape('u_assignment_group', 'FJ Desktop UAM BG');
r.setStringParameterNoEscape('u_rejection_reason', 'ghj');
r.setStringParameterNoEscape('u_state', '3');
var response = r.execute();
var responseBody = response.getBody();
gs.log("Sirraj response getBody: " + responseBody);
var httpStatus = response.getStatusCode();
gs.log("Sirraj response getStatusCode: " + httpStatus);
//gs.log("Sirraj getHeaders " + responser.getHeaders());
//var jsonObject = JSON.parse(responseBody);
return responseBody + httpStatus;
} catch (ex) {
var message = ex.message;
}
},
type: 'Test_Robotic_Automation'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2019 02:36 AM
Hi Sirraj,
How are you sending the value from 1 instance to another?
are you using REST API?
If yes then how are you setting the string value?
you have backslash in your value are you escaping that
use JSON.stringify() to convert the data before sending
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2019 05:35 AM
Hi Ankur,
Thanks for replying me again in another issue.
I am using rest api.! Only i am providing target instance's end point to the source instance.
In source instance -
I have created a outbound rest message where i am using only two methods GET and PUT. Getting record and updating the same record.
In variable substitution only i am feeding value and sending the data to target instance like below.
In my data i am sending backslash and new line. So its throwing error.
If i am sending data as like "value 1" mentioned below its throwing error but if i send "value2" mentioned below its not throwing error.
value 1 :- (backslash and newline)
uk\rbt085r-User does not have a standard email which is a specific requirement for this request.
uk\rbt335r-User has already left the business - no access can be granted
uk\rbt057r-User does not have First Name which is a specific requirement for this request.
value 2 :- ( \ replaced by \\ and newline replaced by \n) no error.
uk\\rbt085r-User does not have a standard email which is a specific requirement for this request.\nuk\\rbt335r-User has already left the business - no access can be granted\nuk\\rbt057r-User does not have First Name which is a specific requirement for this request.
How to overcome this. Any script handling should be done here?
Regards,
Sirraj