Rest Message via Patch Method not working

nomadie
Kilo Expert

Asking help from SN gurus on what's wrong with I'm doing.

Scenario: We will need to send additional comments from 1 SN instance to another SN instance using a correlation_id
Rest message - Patch method: test value are successfully sent over.
Business Rule - failing 

When to run: After / Update
Condition: Additional comments changes

(function executeRule(current, previous /*null when async*/) {

gs.log('In Business Rule New Run', 'ebond');
try { 
gs.log('start here', 'ebond');
 var r = new sn_ws.RESTMessageV2('Ebond', 'Patch Ebond');
 r.setStringParameterNoEscape('sys_id', '81846c281b3b3b409fc9fee58d4bcb71'); //correlation_id
 r.setStringParameterNoEscape('comments', 'BR message starts here');

//override authentication profile 
//authentication type ='basic'/ 'oauth2'
//r.setAuthenticationProfile('authentication_type', 'basic_auth_profile');

//set a MID server name if one wants to run the message on MID
//r.setMIDServer('MY_MID_SERVER');

//if the message is configured to communicate through ECC queue, either
//by setting a MID server or calling executeAsync, one needs to set skip_sensor
//to true. Otherwise, one may get an intermittent error that the response body is null
//r.setEccParameter('skip_sensor', true);

 var response = r.execute();
 var responseBody = response.getBody();
 var httpStatus = response.getStatusCode();
gs.log('HTTP Status : ' + httpStatus,'ebond');
}
catch(ex) {
 var message = ex.message;
}
gs.log("End Business Rule", 'ebond');
	
	
})(current, previous);

Can anyone take a look at this please..

5 REPLIES 5

Nagameshwara pa
Tera Contributor

Hi ,

 

Have you created rest message which you mentioned in script.

If not kindly create rest message with endpoint and create PUT HTTP method under rest message with same endpoint.

 

Thanks,

Pandian