force edit a readonly field

hind
Tera Contributor

Hi all,

we want to give the possibility to Change Author of KB article and since this field is read-only (OOB), to do this, 

I created an ui action "Change author" which calls a ui page that lists the active users as shown below : 

find_real_file.png

the problem is that I can not modify the KB with Published Retired and Outdated status (the Save doesn't work), 

the operation works very well for the rest of the cases : Draft, Review, Sheduled for publish and Pending retirement 

 

my ui page Client script :

find_real_file.png

uBest regards,

1 ACCEPTED SOLUTION

@hind 

Thank you for marking my response as helpful.

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Hi,

either use GlideAjax or update the record using GlideRecord in client script itself

see this link where I shared solution; enhance as per your need

Ensure you send record sys_id from UI action to UI page so that you can get that in client script and query that record

https://community.servicenow.com/community?id=community_question&sys_id=b951a6a2db113050030d44303996...

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@hind 

Thank you for marking my response as helpful.

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

TJLillo
Kilo Guru

If you right click author and configure dictionary, I'd see if it's set to read only at the dictionary level. If so, you could do a dictionary override for each of the templates. They each create an extension of kb_knowledge. Items that are only read only in the form, and not dictionary, can be edited just fine through scripts.

find_real_file.png

 

You could also try setting value and display value, it could be updating the value but not display since it's read only.

https://developer.servicenow.com/dev.do#!/reference/api/quebec/client/c_GlideFormAPI#r_GlideFormSetValue_String_String_String