The CreatorCon Call for Content is officially open! Get started here.

Restrict Variable Formatter to be editable only for certain group for a catalog item

Appu2
Tera Contributor

Hi, I need help with restricting the Variable formatter for certain group for one of the Catalog Item. My requirement is to make the Variable Formatter to be editable only for certain members of the group for rest all others it shouldn't be editable. I need to achieve this via Catalog Client Script. After submitting the request, in the backend Variables should be only editable for certain group and others shouldn't be able to edit.

Any inputs here?

1 ACCEPTED SOLUTION

Follow the below steps.

1. Write display BR on req item table

Condition : item is "select catalog name"

HarishKM_0-1695982632989.png

 

Script:

g_scratchpad.grp = gs.getUser().isMemberOf('ACME Support'); // pass the group name
 
2. Write onload client script on req item table
if(g_scratchpad.grp)

{
  g_form.setVariablesReadOnly(true);

}
 
HarishKM_1-1695982691877.png

 

 

Result:

HarishKM_2-1695982719420.png

 

Regards
Harish

View solution in original post

8 REPLIES 8

Follow the below steps.

1. Write display BR on req item table

Condition : item is "select catalog name"

HarishKM_0-1695982632989.png

 

Script:

g_scratchpad.grp = gs.getUser().isMemberOf('ACME Support'); // pass the group name
 
2. Write onload client script on req item table
if(g_scratchpad.grp)

{
  g_form.setVariablesReadOnly(true);

}
 
HarishKM_1-1695982691877.png

 

 

Result:

HarishKM_2-1695982719420.png

 

Regards
Harish

Appu2
Tera Contributor

thank you so much this solution worked for me.

Appu2
Tera Contributor

Also it's not restricting for anyone if I replace gs with g_form. So this seems not working

even if you use g_user.getUserID to get user ID. The isMemberOf method is a server side method cannot use in client script

Regards
Harish