- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 05:04 AM
Hi Team ,
Am using UI action to show button to incident manger and admin based on three condition
1. u_error_processing== true than show button only incident_manger
2. if u_count=4 than show only to admin
3.if u_error_processing== true and if u_count=4 than show only to admin
below is my condition :
current.u_error_processing== true && gs.hasRole('incident_manger') && current.u_count== '4' && gs.hasRole('admin')
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 06:45 PM
just like the normal case
new scriptIncludeName().functionName(current)
In that script include function you can add those conditions using current object and return true/false
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-06-2023 06:16 AM
You might want to use an OR condition instead for the roles. Something like this
((current.u_error_processing==true && current.u_count== '4') && (gs.hasRole('incident_manger') || gs.hasRole('admin')))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 06:57 AM
why not?
If the UI action condition becomes longer I would recommend to use script include function and invoke it from UI action condition
Did you debug step by step where it's failing?
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-06-2023 09:15 AM
Hi @Ankur Bawiskar thanks for your reply ,can you please share sample code like invoke script include function from UI action .it will be helpfull
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 05:30 PM
The way you'd call a server callable Script Include (aka not ajax). new ScriptIncludeName().FunctionWithinSi(current) and have it return true/false.