Exception when trying to invoke a RESTMessage. OUTBOUND USAGE ANALYTICS

Satyasarat Pato
Tera Guru

I have created a RestMessage and It's from working fine when i'm doing a TEST(UI Action). But when i'm trying to trigger that from a Script Include i'm getting below exception:

OUTBOUND USAGE ANALYTICS - OutboundUsageAnalytics : OutboundUsageAnalytics: Usage analytics send failed
Any let me know, if you have faced before or suggestion to avoid this exception.

Thanks in Advance!
5 REPLIES 5

mmaraj1
Mega Expert

change it to trigger from a business rule (or have your business rule call the script include)

dougconnell
Kilo Guru

Did it work?  I am getting exactly the same error. 

I want to execute a Business Rule that triggers from the em_alert table and then sends the incident number back to the TrueSight event source using a REST API.  I am testing, the Script Include using a Background script.  The background script gets the latest glide record from the em_alert table.

I have tested the REST Message and it works fine and my logging shows that my background script is successfully fetching the latest TrueSight alert from ServiceNow.

dougconnell
Kilo Guru

The OutboundUsageAnalytics message was a red herring.  I got the errorMsg and found out RESTMessageV2 was failnig to resolve my hostname - so the httpStstus was 0.  i.e. it never actually went to the REST API.

The key is: always use: response.getErrorMessage();

}
catch(ex) {
var message = ex.getMessage();
httpStatus = response.getStatusCode();
errorMsg = response.getErrorMessage();
}
if (httpStatus != 200) {
gs.info(logPrefix + 'httpStatus: ' + httpStatus + ', Error: ' + errorMsg);
}
return httpStatus;

Satyasarat Pato
Tera Guru

That's an exception & at the same time i'm getting response as well. So i haven't done anything to resolve the exception.