How to make RITM variables as read only for Other users except Admin?

Giriprasath
Tera Contributor
 
1 ACCEPTED SOLUTION

kamlesh kjmar
Mega Sage
Mega Sage

Hi @Giriprasath ,

 

Activate the Client script suggested by Namrata Ghorpad in the above post and change the script as suggested below:

 

 

function onLoad() {
	if(!g_user.hasRole("admin"))
   g_form.setVariablesReadOnly(true);
}

 

kamleshkjmar_0-1667216700128.png

 

 

Out of the box this client script is inactive so, make sure to make it active before testing.

 

I Hope this helps.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh

View solution in original post

3 REPLIES 3

Namrata Ghorpad
Mega Sage
Mega Sage

Hello,

There is OOB client script to make variables read only - "Variable Editor Readonly" .

You can add your logic here to check current logged in user is Admin or not and based on that you can make variables read only.

 

Please mark my answer as helpful/correct if it helps you.

Regards,

Namrata 

kamlesh kjmar
Mega Sage
Mega Sage

Hi @Giriprasath ,

 

Activate the Client script suggested by Namrata Ghorpad in the above post and change the script as suggested below:

 

 

function onLoad() {
	if(!g_user.hasRole("admin"))
   g_form.setVariablesReadOnly(true);
}

 

kamleshkjmar_0-1667216700128.png

 

 

Out of the box this client script is inactive so, make sure to make it active before testing.

 

I Hope this helps.

 

Please mark this helpful if this helps and Accept the solution if this solves your issue.

 

Regards,

Kamlesh

Community Alums
Not applicable

Hi there,

 

You can write the below catalog Onload client script.

 

 

 

function onLoad() {
   //Type appropriate comment here, and begin script below
   var ruser = g_user.hasRoleExactly('admin');
	
if (!ruser) {
g_form.setReadOnly('list_of_assets', true); - //Add your fields which you have to make read only
}
}

 

Make sure you tick Applies on Requested item in Catalog client script.

Gagan5_0-1667218400358.png

 

 

If your issue got resolved close the question by Accepting solution and hit thumb icon.

Hope it will help you.

Regards,

Gagan K