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 01:52 AM - edited 11-15-2022 01:52 AM
Hi @Abhijit Das7 ,
Try the below script, it should work:
Execute if true:
$$('BUTTON').forEach(function(item){
if(item.value == 'instruct_knowledge')
{
item.hide();
}
});
Execute if false
$$('BUTTON').forEach(function(item){
if(item.value == 'instruct_knowledge')
{
item.show();
}
});
I hope this helps.
Regards,
Kamlesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 02:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 02:32 AM
@Abhijit Das7 share screen shot of your ui action, ui policy condition and ui policy script.
Regards,
Kamlesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 02:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2022 03:03 AM
Hi @Abhijit Das7 ,
Is your Status field a text field ? I would suggest put an alert("Hello") at line number 2 of your script to verify your UI policy is executing.
Now the issue that I can see is your script is, you are using front end value of your UI action as a value, which is not right. It should be UI Action name which in your case is 'instruct_knowledge', so in your script replace 'Create Knowledge Article' with 'instruct_knowledge' and then test.
It should work. I did testing on my instance and it's working. But in case if it still do not work, then put an alert("Hello") statement at line number 2 of both the script and check if your script is executing at all.
Regards,
Kamlesh