I want to log in client script

bonsai
Mega Sage

I'm looking for a way to log to the syslog table like "gs.info" in a client script.

1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

If you want to log it log table then you need get the logic converted to a Script Include & then call the Script Include from Client Script.

View solution in original post

4 REPLIES 4

Rahul Kumar17
Tera Guru

To log to the syslog table in a client script in ServiceNow, you can use the gs.addInfoMessage() method. This method adds an info message to the session log and the log entries are stored in the syslog table.

Here's an example of how to use it:

gs.addInfoMessage('This is an info message logged to the syslog table.');

This will log the message to the syslog table with the severity level set to info. You can also use gs.addErrorMessage() to log error messages to the syslog table.

 

Thanks,

Rahul Kumar

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar

thank you.

But this didn't work.

Jaspal Singh
Mega Patron
Mega Patron

If you want to log it log table then you need get the logic converted to a Script Include & then call the Script Include from Client Script.

I use the same method as a substitute.