Make knowledge article body readonly as soon as the knowledge articles is published

Bhavana Ramesh1
Tera Contributor

Hello,

we need to make the knowledge article body read-only as soon as the state changes to published and we are using the Global "Publish" UI action and do i need to write ui action to achieve this requirement, if so can you please share me the code.

Regards,

Bhavna

1 ACCEPTED SOLUTION

AbhishekGardade
Giga Sage

Hello Bhavana,

What's Difficult in it?

1.Simply create a UI Policy and add condition when Workflow IS Published.

2. With the help of UI Policy Action, Make Read Only TRUE For Article body:

NOTE: Though field is not grayed out but its non editable/read only.

Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade

Thank you,
Abhishek Gardade

View solution in original post

4 REPLIES 4

Weston Wilson
Tera Expert

If you enable the "Knowledge Management Advanced" plugin in ServiceNow, versioning will be enabled and when an article is published, it will become read only until checked out. If you can't do that, would a UI Policy work for making the article read only, rather than a UI Action? 

AbhishekGardade
Giga Sage

Hello Bhavana,

What's Difficult in it?

1.Simply create a UI Policy and add condition when Workflow IS Published.

2. With the help of UI Policy Action, Make Read Only TRUE For Article body:

NOTE: Though field is not grayed out but its non editable/read only.

Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade

Thank you,
Abhishek Gardade

1.You need use Either UI policy of Client client in order to achieve your requirement. Its recommended to stay with Out of the box functionality. 

2. You can try creating a Client side UI action by clicking Client checkbox true and add folllowing code:

function makeReadOnly(){

alert("ui action called");

if('Add condition '){

g_form.setReadOnly('u_net',true);

}

}

but you need to use UI policy or onLoad Client client at the end

Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade

Thank you,
Abhishek Gardade

The SN Nerd
Giga Sage
Giga Sage

I personally would not recommend using UI Policy in this scenario.
Your requirement is to enforce security - that is what ACL's are for.

I'd strongly recommend checking out the Knowledge Management Advanced plugin as Weston has mentioned.
Not only will this address your requirement, but you'll also get a whole lot of great additional features such as Knowledge Versioning and Knowledge Blocks.

If you aren't in a position to adopt this plugin, use ACL's to lock down your KB articles that are in a published stage to meet this requirement. If you use UI Policy, a user can always just re-enable the field using any modern browser to make changes.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022