how to make fields readonly on workspace contextual side bar

VSN
Tera Expert

in workspace form, their is one contextual side bar template .

VSN_0-1742290185695.png

when user open the template, fields are in editable as shown in below screen shot. i wanted to make them readonly for a set of role user. 

VSN_1-1742290310896.png

how can i achieve that functionality.

4 REPLIES 4

Shivalika
Mega Sage

Hello @VSN 

 

This contextual side bar should be a "Data Resource". So go the UI Builder and in this specific Workspace - look for data resources in the left side. Modify it in transform script. 

 

If it's not configured using a data resource, then a client script can work. But you need to check this in your UI builder. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway,

 

Regards,

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwN

eEISQCY

Ankur Bawiskar
Tera Patron
Tera Patron

@VSN 

you can use table.Field level WRITE ACLs on "sys_template" table with that field and add script to check if user doesn't have role

OR

you can use onLoad client script on "sys_template" table and check role and make them readonly

function onLoad() {
    if (g_user.hasRoleExactly('rolename') && g_form.getValue('table') == 'incident') {
        g_form.setReadOnly('fieldA', true);
    }
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@VSN 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@VSN 

Hope you are doing good.

Did my reply answer your question?

Members have invested their time and efforts in helping you.

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

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