Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Scripting a note in the Activity Log

richard_selby
Kilo Guru

Can I add a comment to the Activity Log via a script?
We have a client script which makes a REST call (http get) to an external system, which triggers a customer satisfaction survey email.
If the Http Get call returns 200, I'd like the Activity Log to say "Customer Satisfaction survey sent out to xxxxx".
So this is not logging activity on a service now table, it's really entering a comment based on what an external system returns.
Is there a bit of code which would enter a note directly on the log for a ticket?

2 REPLIES 2

adiddigi
Tera Guru

Say you are using the REST Module in service Now,You will be writing this on a Business Rule on a record say Incident 001. So the code will be something like this:



var r = new RESTMessage('Name_of_the_rest_message', 'get');
var response = r.execute();
//From here you can get the status code:
var status = response.getStatusCode();


Now you have the status with you, You will need to write some code to glide some history tables, to insert that into Activity Log.

Here is the exact way you can do that : http://www.servicenowguru.com/system-definition/remove-activity-log-journal-entries/

Instead, using worknotes, will be easier....


richard_selby
Kilo Guru

Thanks for pointing me towards SN Guru. That explains nicely.