The CreatorCon Call for Content is officially open! Get started here.

Hide/Show UI Action using UI Policy

Abhijit Das7
Tera Expert

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

 

8881.JPG

 

I used above method, somehow it is not working.

 

cc: @Ankur Bawiskar @kamlesh kjmar 

 

Thanks in advance

16 REPLIES 16

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

Hi @kamlesh kjmar 

 

Still no better.

Thanks

@Abhijit Das7  share screen shot of your ui action, ui policy condition and ui policy script.

 

Regards,

Kamlesh

Hi @kamlesh kjmar 

 

hghh1.JPGhghh2.JPGhghh3.JPG

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.

kamleshkjmar_0-1668510141983.png

 

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