State changes to approval

pramn
Tera Guru

Hi Team , 

Need some help in scripting part , Requirement is Set below fields to read-only after approval is requested

cmdb_CI,cat,subcat,shortdescription,description

I tried with UI Policy , but looks like it doesn't work .

12 REPLIES 12

I have mentioned state "Requested" for reference, You can write query to the actual field which you used to trigger the approval.

 

If for instance, If approval is getting triggered when State is "Approval Requested", Then write your UI policy to state is "Approval Requested" and UI policy action to the fields you want to make read only.

You means to say  this action 

pramn_0-1731321808047.png

 

Hello @pramn ,

 

Please provide your detailed req with which table and state you are trying to achieve this, So I can provide the valid solution, Thanks.

change request

SufiyanMurshad
Tera Contributor

Hii pramn, 

If UI Policy not working then You need to implement with Client Script

Client Script Type: Onload

Script:

(function executeClientScript() {
    if (g_form.getValue('approval') == 'requested') {
        var fields = ['cmdb_ci', 'cat', 'subcat', 'short_description', 'description'];
        fields.forEach(function(field) {
            g_form.setReadOnly(field, true);
        });
    }
})();
 
i'm check script is working properly in SN PDI.
 
Please mark my answer as correct and helpful if it works for you.
 

Best Regards,

Sufiyan Murshad