How to make catalog form as ready only after task status changed to closed complete.

Deepika43
Tera Contributor

In my requirement need to make the catalog form to be closed complete after task status was changed to closed complete. 
In detail, If the approval is approved. It will create catalog task with status closed complete. Next, step should be once the catalog task was created with closed complete the catalog form should be read only.

I used client script for this but not working. Here I attach the screenshot of the script. 

Deepika43_0-1695192624736.png

Please suggest is any other method. 
If UI policy means no. I will affect globally. Only for x catalog item this should be done. 

 

2 ACCEPTED SOLUTIONS

Sagar Pagar
Tera Patron

Hi @Deepika43,

 

Make sure that values for close complete is correct and

 

Syntax:

 g_form.setReadOnly('field_name', true/false);

 

I would suggest to use UI policy with needed conditions and add fields with Read only as true.

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow

View solution in original post

Daniel Borkowi1
Mega Sage

@Deepika43 , I would use a UI Policy or Client Script within Catalog Item (Maintain Item --> Your Catalog Item --> related List UI Policy or Client Script). And remove in your Condition "Closed Complete" with "3".

Greets
Daniel

Please mark reply as Helpful/Correct, if applicable. Thanks!

View solution in original post

5 REPLIES 5

Sagar Pagar
Tera Patron

Hi @Deepika43,

 

Make sure that values for close complete is correct and

 

Syntax:

 g_form.setReadOnly('field_name', true/false);

 

I would suggest to use UI policy with needed conditions and add fields with Read only as true.

 

If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍🏻
Thanks,
Sagar Pagar

The world works with ServiceNow

Daniel Borkowi1
Mega Sage

Hi @Deepika43 , you can also add UI Policies in Catalog Item like you do with Client Script - or if you want to reuse it, you can move UI Policy in a Variable Set. In your script getValue doesn't deliver the Display Value "Closed Complete" that's why your Condition is wrong. You should check for '3'. And remove the isLoading condition as you want to have this field also readonly as soon as it changes to this state. Otherwise only if you open an already closed task it will be readonly.

Greets
Daniel

Please mark reply as Helpful/Correct, if applicable. Thanks!

Deepika43
Tera Contributor

I need to make catalog task form as read only. The below mentioned form 

Deepika43_0-1695194419563.png

 

Daniel Borkowi1
Mega Sage

@Deepika43 , I would use a UI Policy or Client Script within Catalog Item (Maintain Item --> Your Catalog Item --> related List UI Policy or Client Script). And remove in your Condition "Closed Complete" with "3".

Greets
Daniel

Please mark reply as Helpful/Correct, if applicable. Thanks!