Outbound REST request fails with no error message

karanpreet
Tera Guru

Hi,

I'm trying to trigger a business rule which executes on addition of notes/additional comments on an incident and should Ideally send the latest note through the REST API to another system.

I've created a business rule which executes okay but I'm getting nothing in the REST response. This is what I get in the debugging:

02:27:16.460: : Content:

02:27:16.461: : Request Body: [object RESTResponseV2]

02:27:16.462: : Response:

02:27:16.463: : HTTP Status: 0

02:27:16.464: : Error Message:undefined

The script in the business rule is as follows:

function onAfter(current, previous)

{

var r;

var response;

var responseBody;

var httpStatus;

var message;    

try {

r = new sn_ws.RESTMessageV2('global.send_test', 'put');

response = r.execute();

responseBody = response.getBody();

httpStatus = response.getStatusCode();

}

catch(ex) {

message = ex.getMessage();

}

gs.info("Content: " + current.work_notes.getJournalEntry(1));

gs.info("Request Body: " + response);

gs.info("Response: " + responseBody);

gs.info("HTTP Status: " + httpStatus);

gs.info("Error Message:" + message);

}

The Outbound REST 'send_test' used above looks like this:

find_real_file.png

find_real_file.png

find_real_file.png

I'm new to service now and would really appreciate any help!

Regards,

Karan

1 ACCEPTED SOLUTION

karanpreet
Tera Guru

Hi,



I know this is an old question but since I was able to resolve it I thought I'll update it here as well.



Turns out the Service now instance wasn't able to reach the endpoint as it was behind a firewall. I got the details of the Mid server and once I routed the request through the mid server it went through fine.



Regards,


Karan


View solution in original post

5 REPLIES 5

manish123
Giga Guru

Hi All,



I have developed outbound REST API in Eureka version and its working perfect except for work notes and additional comments. Could anyone please let me know how to move it? Below is line of code :-



var comm= inc.comments.getJournalEntry(-1).toString();  


comm=comm.replace(/["']/g, "");  


comm=comm.replace(/[\n*]/g, "");      


comm=   String(comm);



And trying to feed this string to Import set staging table but there its appearing as blank. Any idea where its getting wrong?