Debug condition in UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2017 10:35 PM
Hi All,
i have condition in my UI Action as follows:
(gs.hasRole('admin') || gs.hasRole('approval_admin') ) && (new CreditCardGlobalUtil().hideApproveButton(current))
I want to debug it whether it is working or not as i got to know that i should use OR condition in place of AND as False && False = True.
Can anyone suggest.
Regards,
Shikha Khanna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2017 10:45 PM
HI Shikha,
You can use js.log(). Please refer to the following link
Darshak
Edit:
Ah! My bad, I mistook it as client side of UI action. The server side scripting can use gs.info() to print the result o the system logs.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2017 11:07 PM
Hi Shikha,
You can use Scripts - background, with elevated security admin privileges. Generate your code in there to test, using gs.print to display results. Note that this is segregated so you cannot use "current."
another approach is you can user gs.log(); to capture the logs in system logs and check it there or you can use gs.addInfoMessage() or gs.addErrorMessage() since you are using server side scripting in your UI Action.
for More details: Scripting Alert, Info, and Error Messages - ServiceNow Wiki
Debugging Tools Best Practices - ServiceNow Wiki