- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2017 03:40 AM
Third party User need to update the RITM(requested item) to service now instance using scripted web service.How i can achive this please help me out.
Example : suppose he want to update comment field so for that he will provide ritm number as a input. Based on the number need to get the field details from user and need to update to coresponding RITM.How can achive this please help me out.
Thanks
Prakash Ranjan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-15-2017 03:59 AM
Hi,
You need to Navigate to Scripted Rest Api's module and define a new Service say as Update RITM and fill in the Scripted Rest form. Once you save the form you need to define the Resources where you can define the required HTTP method say you can use "PUT" in your scenario to update and write a script as below:
Script:
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
var remote_number = request.u_number1; Number coming as input from Source Application
//gs.log('Remote Number is' + remote_number);
var gr = new GlideRecord('sc_req_item');
gr.addQuery('u_rest_request', remote_number);
gr.query();
if(gr.next()) {
gr.short_description = request.short_description;
gr.update();
return {'Status' : 'The Request created is:' + gr.u_rest_request};
}
else{
return {'Status' : 'The request is not created'};
}
})(request, response);
Hope this helps.mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2017 04:27 AM
Hi,
May I know what the setting under the Business Rule tab When to run and Action is? I have used the script above, but when I try to submit, I keep getting this error:
missing function declaration for onAfter.
The When to run setting is After, Insert and Update as suggested above.
Please help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2017 04:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2017 04:45 AM
Hi,
Thanks for the, yes That is what my set up is, but I have filted my own condition. I cant save it though. It keeps saying, Missing function declaration for onAfter. :S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2017 04:54 AM
Can you share the screen shot of the Business Rule you have configured.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2017 05:02 AM