Making Variables editable on Catalog Task Form

Angshuman3
Mega Guru

Hi All,

Is it possible to to make variables editable on catalog task form based on user roles by using Client Script??...

The requirement is some variables should be editable for ITIL users 

Can someone help me with this?

Thanks and Regards,
Angshuman

1 ACCEPTED SOLUTION

Bhawana Upreti
Tera Guru

Yes, It is possible. You can write a client script like if user has role set field to writable else readable.

      var rqdrole = g_user.hasRole('RoleName');

       if (rqdrole){

              g_form.setReadonly('fieldname',false);

       }

Hope this helps.

Thanks.

   

View solution in original post

18 REPLIES 18

Did you try it with the UI policy??

Hey,

Yup I tried with UI Policy, it didn't work. But, with Client script it worked, so I had to modify some part of your code....
But thanks a lot for the help...!! 🙂

Thanks,
Angshuman

Could you please let me know what did you modify to make it work?

Thank you!

Hi Bhawana,

This is the code which I used,

function onLoad() {
       
         if (!g_user.hasRole('admin')) {

                if (item =='CATALOG_ITEM_NAME' && item =='CATALOG_ITEM_NAME') {
                         
        g_form.setVariablesReadOnly(true);

        g_form.setReadOnly('FIELD_NAME', false);


}

}
}

I hope this might help you..!!

Thanks,
Angshuman

Thanks much for the information! 🙂