how to make REQ form as read only when state is closed complete for particular catalog item.

Deepika43
Tera Contributor

In my requirement, service management is the name of catalog item. If the request is closed complete the form should be read only. I tried to use UI policies but, I can't done for service management catalog item alone.

 

So, Please suggest how to make sc_request table filed form should be ready only for service management catalog item.

1 ACCEPTED SOLUTION

Badal Khojare
Mega Sage
Mega Sage

Hi @Deepika43 ,

Did you check this video by Amit. Update conditions based on your requirements like catalog item name etc. https://www.servicenow.com/community/developer-articles/servicenow-use-case-make-all-fields-read-onl...

Please Mark My Response as Correct/Helpful if it helped.
Regards,
Badal Khojare
Community Rising Star 2023

View solution in original post

4 REPLIES 4

Badal Khojare
Mega Sage
Mega Sage

Hi @Deepika43 ,

Did you check this video by Amit. Update conditions based on your requirements like catalog item name etc. https://www.servicenow.com/community/developer-articles/servicenow-use-case-make-all-fields-read-onl...

Please Mark My Response as Correct/Helpful if it helped.
Regards,
Badal Khojare
Community Rising Star 2023

manjusha_
Kilo Sage

@Deepika43 

 

Create a table.none read acl (here table is sc_request)

In condition add -state is closed complete 

In Acl script  add - answer =false;

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact

Thanks,

Manjusha Bangale

Deepika43
Tera Contributor

this read only should not affect for other catalog item. I need for 'service management'  catalog item alone.

Riya Verma
Kilo Sage
Kilo Sage

Hi @Deepika43 ,

 

Hope you are doing great.

 

To make the form for the "service management" catalog item read-only once the request is closed, follow these steps:

  1. Create a Business Rule: In the Advanced tab, set the condition to trigger this rule when the request is closed. In the script, use GlideForm methods to set the form fields to read-only.

    (function executeRule(current, previous) {
        if (current.state == 7) { // Assuming 7 represents "Closed" state
            var form = current.getGlideForm();
            form.setReadOnly(true);
        }
    })(current, previous);
    
  2. Apply UI Policy:

    • Navigate to Service Catalog > Catalog Definitions.
    • Find your "service management" catalog item.
    • Click on it, then go to the Policies related list.
    • Create a new UI Policy.
    • Set the condition to apply when the request is in a closed state.
    • In the UI Policy Actions, choose Make Read-Only for the form fields you want to lock.
 
 
 
Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma