Debug condition in UI action

geet
Tera Guru

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

2 REPLIES 2

Rama Chandra D
Kilo Guru

HI Shikha,



You can use js.log(). Please refer to the following link



https://developer.servicenow.com/app.do#!/lp/servicenow_application_developer/app_store_learnv2_scri...



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.


Shishir Srivast
Mega Sage

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