How to call OUTBOUND REST Message in an UI Action. FYI: This integration is inside a scoped application & authentication type is 'oauth2'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2021 10:39 PM
How to call OUTBOUND REST POST Message in an UI Action.
FYI: This integration is inside a scoped application & authentication type is 'oauth2'.
Requirement: On create Button Click REST POST Message should trigger & after success values to be set in Form from response values.
I already tried using Preview Script Usage from REST POST Message in UI Action, but it's not working.
try { var r = new sn_ws.RESTMessageV2('Testxxxxxxxx', 'post');
r.setAuthenticationProfile('oauth2', profile name);
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
} catch(ex) {
var message = ex.message;
}
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2021 09:34 PM
Please find points below
1) REST OUTBOUND call is inside a scoped application. Is this matter?
- Using REST Message V2 should be fine in Scoped application as well
2) Authentication Type as mentioned "oauth2", which is token based. So how to do the same in this. Can you please share some sample code to embed REST OUTBOUND POST Method with the above authentication in place to make an asynchronous call.
- You need to setup OAuth Profile and enter all the details and then associate this OAuth profile to your REST Message when you create
Configure a REST message with OAuth
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader