Hide/Show UI Action using UI Policy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 01:06 AM
Hi Everyone,
I want to hide/show UI Action using UI Policy. If status of record is deleted then it should hide UI action otherwise it should be visible.
UI Action:
Name = Knowledge Article
Action Name = instruct_knowledge
I used above method, somehow it is not working.
cc: @Ankur Bawiskar @kamlesh kjmar
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 03:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 03:23 AM
So the issue is with the condition. Please check your condition of UI action. But at least one alert should have triggered. Did you put alert() in both the scritpt (execute if true amd execute if false) ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 03:24 AM - edited 11-15-2022 03:27 AM
Sorry, Now I am getting alert() in both type of script ( alert('hide') and alert('show')). They are perfectly working according to situation. But button is hiding.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 03:46 AM - edited 11-15-2022 03:48 AM
@Abhijit Das7 I saw your previous screen shot, your UI policy was inactive that's why alert would not have triggered. But in case you activeted it and both your script sections are alerting as per condition and still button is not hiding then it would require debugging.
I tried same code in my PDI which I advised you and it's working perfectly fine for me:
Rgards,
Kamlesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 02:03 AM
modify script as this-> use the UI action name to search in the index and not the action name
so use Knowledge Article instead of instruct_knowledge in script
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader