Using Scoped REST Message within scoped application

abuthahir
Tera Expert

Hi All,

I have an Outbound REST message to post. I have created it within the scoped application and i have table in the same scope. I am trying to run a business rule script to run this REST Message whenever there is a record inserted. Am setting the body in a perfect manner still its not happening. [httpStatus is 0]. When i try the same body in the rRST message "Test" functionality its working perfectly. May i know what is the issue.? Please let me know . ctomasipradeepksharma kalai

var r = new sn_ws.RESTMessageV2('rest message name', 'post');

  var body = '{"JSON Body comes here"}';

  r.setRequestBody(body);

  var response = r.execute();

  var responseBody = response.getBody();

  var httpStatus = response.getStatusCode();

1 ACCEPTED SOLUTION

I wasn't aware of that either. Thank you for sharing Abu.



The only reason I can think of for blocking it is because REST, but default is a synchronous operation. For example, if it takes 10 seconds to get a response from the remote REST host, your browser is stuck waiting in a before/after business rule and presents a poor user experience. Async rules process in the background so the user doesn't have to wait.


View solution in original post

10 REPLIES 10

The problem is that you need to dot walk the scope. For example: You have a rest message in the scope "assistants", you would need to write assistants.rest_message_here 

var r = new sn_ws.RESTMessageV2('assistants.rest message name', 'post');