Make a field editable in native view and read only in workspace

Vamsi43
Tera Contributor

Hi Team,

I require the a field to be editable in native view but should be read only in workspace view.

Please let me know How can we achieve This.
Thank you.

1 ACCEPTED SOLUTION

Tai Vu
Kilo Patron
Kilo Patron

Hi @Vamsi43 

You can implement an UI Policy, making a field readonly for a specific view of a table. Sample below.

Timi_0-1724147892898.png

 

In case you'd like to implement a Client Script. Sample below

Timi_1-1724147983166.png

 

Cheers,

Tai Vu

View solution in original post

8 REPLIES 8

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Vamsi43 

 

Not a good way, UI policy work on Global or specific view only.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

hi @Dr Atul G- LNG 

is there any alternative way of achieving this?

 

Might be via some script but it is not recommended and you will add a loophole in system.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

I got the below client script code from the community. which is not working 

can you pls help me with the adjustment where i'm not this script on business_unit table 

 

function onLoad() {
    //Type appropriate comment here, and begin script below
    var url = top.location.href; // getting the URL Link
    var pathname = new URL(url).pathname; // getting the Path workspace : now/risk/, Native :now/nav/ui/.
    pathname = pathname.split('/');
    var ur = pathname[2];// getting if its a workspace or native
    if ( ur == 'nav') {
          g_form.setReadOnly("name", false);// editable for UI 16
      }
else{
         g_form.setReadOnly("name", true);// Read only for SOW Workspace
        }
    }
}