UI action to show an information message with the sys_id of your department in servicenow

divya123
Giga Contributor

how can i do this exercise... Set up a department on your user record. Use a UI action to show an information message with the sys_id of your department in servicenow

kindly help me with your suggestions

Regards

Divya

1 ACCEPTED SOLUTION
6 REPLIES 6

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

You pretty much have 3 options.



1. Use a UI Action with server code. This will thou save the record when you press the button. But this code would solve it:


var currentUser = gs.getUser();


gs.addInfoMessage(currentUser.getCompanyID());



2. Use a display Business Rule to put to company ID into the g_scratchpad and then call for it in the UI Action



3. User a GlideAjax call to find the sys_id and do a message with the response from it.



//Göran


Hi Goran,



thanks for the response if possible can you elaborate with that.



Regards


Divya


which one?


1. Use a UI Action with server code. This will thou save the record when you press the button. But this code would solve it:


var currentUser = gs.getUser();


gs.addInfoMessage(currentUser.getCompanyID());