Making variables editable for a particular group in sctask service catalog.

Rahul21
Mega Contributor

Hello Experts,

 

In my catalog item there are some variables which are only avaliable in sctask form. So I have a requirement in which on the basis of particular group  , I have to make the variables editable in (sctask) in my service catalog . suppose if a user is a member of that particular group then he can be able to fill that information over there in sctask form....Apart from that no- body can edit that variables..

 

Need script for this . Preferable (Script include and Client script)

 

Thanks

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use onLoad catalog client script + GlideAjax and check if logged in user is member of that group or not

this link has sample script

Is Memberof Group from Client side

Regards
Ankur

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

View solution in original post

2 REPLIES 2

Hugo Gomes
Kilo Guru

If you can use client scripts, you should also consider UI Policies, they have the same behavior as a "OnLoad" client script.

 

But, answering your question, you can create a client script, OnLoad, that will check the user groups by calling an GlideAjax function. For that you need to pass the user ID, and the current group of the sc_task.

On the script include, check if the pair UserID and group is present in the table "sys_user_grmember". If yes, than you can set the read-only to false.

You can define all of this in UI Policy, using the script part.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use onLoad catalog client script + GlideAjax and check if logged in user is member of that group or not

this link has sample script

Is Memberof Group from Client side

Regards
Ankur

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