Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Outbound Rest Message (which uses OAuthToken) not working in the Run script Workflow

ashwryadj
Tera Expert

Outbound Rest Message (which uses OAuthToken) not working in the Run script Workflow


var r = new sn_ws.RESTMessageV2('<Rest Message>, '<method name>');
r.setStringParameterNoEscape('userId', '<userId>');
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
var json = new global.JSON();
var resp = JSON.parse(responseBody);
 
this code is working in the background script of the instance by the same code is not working in the workflow run script when request is submitted.
 
PLEASE HELP! 
 
1 ACCEPTED SOLUTION

ashwryadj
Tera Expert

It finally worked when the rest call was executed via Business Rule,

I created an asynchronous BR to implement it.

View solution in original post

6 REPLIES 6

Hi @Ankur Bawiskar @rajeev17 ,

 

The workflow is giving me error - 
"problem retrieving authentication profile" 

 

Could you please suggest what should be done in this case ? 

Thank you in advance ! 

ashwryadj
Tera Expert

It finally worked when the rest call was executed via Business Rule,

I created an asynchronous BR to implement it.