UI action use scratchpad

Lean S
Mega Expert

HI All,

I have a business rule capturing user logged in with some roles validation and captured in scratchpad value. and now I want to use that scratchpad in UI action - conditions section for displaying button on validation. How can I use g_scratchpad in UI action. Please guide

 

Thanks,

Lean S

 

1 ACCEPTED SOLUTION

Tiffany Royer
Giga Guru

If you are doing role validation in your UI action, you don't need to use the scratchpad.

Example: Only logged in Users with itil can see the UI action
gs.hasRole('itil')


If for some reason you are doing something unique with your check, you can do the scratchpad

Business Rule Display Storing Scratchpad Value
find_real_file.png

g_scratchpad.users = ['62826bf03710200044e0bfc8bcbe5df1', 'a8f98bb0eb32010045e1a5115206fe3a'];



UI action Check
find_real_file.png

 

g_scratchpad.users.indexOf(gs.getUserID()) >-1

 

My Admin account could not see the UI Action, But when I impersonate one of the users listed in the scratchpad, I can see it. 



If this was able to answer your question, please mark it as the Accepted Solution so the question will appear as resolved for other users who may have a similar question in the future.

View solution in original post

5 REPLIES 5

Jagadeesh1
Kilo Guru

Hello,

 

    if the display business rule is capturing the g_scratchpad variables, you can use the same in client side scripting of UI action

 

Thanks,

Jagadeesh

Hi Jagadeesh,

I am using like below in BR 

g_scratchpad.isexist == 'true'

and it is storing user logged in value

I have tried it giving in condition in UI action in Same way  g_scratchpad.isexist == 'true'

 

but not working

 

please suggest

Hi,

it should work the same way it does in client script

please share the complete BR script and client script

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Can you please share UI Action script you are using? And also the the BR if possible?