Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

knowledge

Bhavani1995
Tera Contributor

how to hide translate ui action on a knowledge form for few knowledge bases

2 REPLIES 2

M Iftikhar
Tera Sage

@Bhavani1995 ,

So on my PDI I have OOTB UI action on KB article form shown below:

MIftikhar_0-1759306008064.png

Upon checking this UI action definition I can see condition to show this UI action on few KBs, so you can leverage the same approach for your use case.

MIftikhar_1-1759306079227.png

In the Translate UI action, just update the Condition field to check against the Knowledge Base sys_ids. For example:

!gs.nil(current.kb_knowledge_base) &&
['429b07aaXXXXXXX', '91a8f1aXXXXXXXc7e9']
    .indexOf(current.kb_knowledge_base.toString()) == -1 &&
current.workflow_state == 'published'

This way, the Translate button will only show when the KB article is published and the KB is not in the restricted list.

That keeps everything server-side in the condition itself and avoids needing extra client scripts.

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.

 

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.

M Iftikhar
Tera Sage

Hi @Bhavani1995

 

Is this the UI action you were talking about?

I searched and got this one: Translate_Knowledge_Full_Category_String. 

Update your instance url, then you can access this UI action. If this is the same UI action you're talking about then you can follow the given solution.

MIftikhar_0-1759306718650.png

 

So to hide this UI Action for specific Knowledge Bases, you should modify its condition. In the Condition field, you need to add a check to exclude the specific knowledge bases. The best way to do this is to check if the current record's knowledge base sys_id is not in a list of the KBs where you want to hide the button. For example, you would add 

&& ['sys_id_of_kb1', 'sys_id_of_kb2'].indexOf(current.kb_knowledge_base.sys_id.toString()) == -1 

to the end of the existing condition. This is the standard method for conditionally controlling the visibility of a UI Action without altering its core script.

 

Hope this helps!

 

Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution and helpful so others can benefit as well.

 

 

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.