Getting Error Constructing REST Message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2019 08:06 AM
Hi,
I am trying to set up a REST webservice with a customer using JIRA. When I set up the Outbound webservice and enter the HTTP request and click test it is successful, taking the values of variable substitutions.
I have a business rule running to try and get these variables to complete dynamically based on the information in the ticket that was logged. When I check the logs I get the below message;
'EXCEPTION during ESPCollinson.prepareMessage(Request, post):
Error constructing REST Message/Method: Collinson - Request/post'
If i put this BR into background scripts then I get a larger error message;
'org.mozilla.javascript.EcmaError: Cannot read property "short_description" from null
Caused by error in script at line 5
2:
3: // Add your code here
4: var message = ESPCollinson.prepareMessage('Request', 'post');
==> 5: message.setStringParameterNoEscape('ShortDesc', current.short_description);
6: message.setStringParameterNoEscape('Description', ESPCollinson.jsonEscape(current.description));
7: gs.log('RB - Im here in Collinson REST New Incident');
8: })(current, previous);
org.mozilla.javascript.EcmaError: Cannot read property "short_description" from null
Caused by error in script at line 1
==> 1: (function executeRule(current, previous /*null when async*/) {
2:
3: // Add your code here
4: var message = ESPCollinson.prepareMessage('Request', 'post');'
My gs.log is printed in the script logs.
I have attached my HTTP request in the REST message and the script include I'm using as a helper (this is how it has been done in the past for other REST integrations).
Any help would be greatly received.
Thanks,
Rob
- Labels:
-
Incident Management
-
Service Desk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2019 02:23 AM
Hi Robert,
Can you add try catch block to handle the exception?
the error says it is unable to find short_description on null object; so it means it is not able to know what current object is.
Regards
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
‎08-06-2019 08:22 AM
What is the table the BR is on? Please post screenshots of the BR
Vinod Kumar Kachineni
Community Rising Star 2022