Variable Read only for Catalog Task

Arun87
Giga Contributor

Hi Team,

 We have created one form and it contain 10 variables. 5 variables are filled at the time of creating the request. Once it is approved by the line manager it will create  the catalog task1, in this task group owner need to fill the 3 variables. In this task 5 variables are read only. Once this task it is closed it will create other task2 requesting the group owner to fill other 2 variable. In this task2 previously filled 3 variables should be in read only. once task2 is closed it will create task 3 and all the variables should be in readonly. Please help me how to achieve this.

1 ACCEPTED SOLUTION

You can call me at 9885189192

View solution in original post

42 REPLIES 42

Anil Shewale
Mega Guru

Hi Arun

you have to write the client script or ui policy only , for making field read only. you can not make field read only on workflow activity.

refer the following thread might help you.

https://community.servicenow.com/community?id=community_question&sys_id=9f301fe5dbdcdbc01dcaf3231f96...

If it help mark helpful or correct.

Thanks and regards

Anil

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Arun,

you can have single catalog client script onLoad which applies on Catalog Task

UI Type -  All

in the script determine which task it is based on short description and accordingly make those variables as editable or readonly

I assume each Catalog task has unique Short Description

function onLoad(){

var shortDescription = g_form.getValue('short_description');

if(shortDescription == 'Catalog Task 1 Short Description'){

g_form.setReadOnly('variable1', true);

g_form.setReadOnly('variable2', true);

}

if(shortDescription == 'Catalog Task 2 Short Description'){

g_form.setReadOnly('variable3', true);

g_form.setReadOnly('variable4', true);

}

if(shortDescription == 'Catalog Task 3 Short Description'){

g_form.setReadOnly('variable4', true);

g_form.setReadOnly('variable5', true);

}

}

Regards
Ankur

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

Hi Ankur,

It is not working as expected. I even tried with other field as well. But also it not working.

Hi Arun,

Please share which field will be unique on sc_task

Also please share your script

Regards
Ankur

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