- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2021 05:12 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2021 05:52 AM
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
g_scratchpad.users = ['62826bf03710200044e0bfc8bcbe5df1', 'a8f98bb0eb32010045e1a5115206fe3a'];
UI action Check
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2021 05:18 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2021 05:44 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2021 05:47 AM
Hi,
it should work the same way it does in client script
please share the complete BR script and client script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2021 06:40 AM
Can you please share UI Action script you are using? And also the the BR if possible?