Requirement:- State should be read-only for Incident form new record

VijayKummamuru
Tera Expert

VijayKummamuru_0-1742042740999.png

 

I have written below script and checked Inherited its is executing on task table but not working on extended tables like incident not getting what is the issue 

 

function onLoad() {
    //Type appropriate comment here, and begin script below

    if (g_form.isNewRecord()) {
        g_form.setReadOnly('state',true);
    } else {
        g_form.setReadOnly('state',false);
    }

}

 

@Atul Gupta @Ankur Bawiskar @itsm @Developer 

1 ACCEPTED SOLUTION

J Siva
Tera Sage

Hi @VijayKummamuru 

Always UI policies will have higher priority because UI policies will execute after form loading where as Client scripts will execute with form loading.

Now the reason why your client script is not working is because of "Make fields read-only on close" UI policy on Incident table.

As per that UI policy, the state field becomes read-only, only when the state is closed or cancelled.

To achieve your requirement, you need to either deactivate the ui policy or create new ui policy under incident table.

 

Hope this helps.

Regards,

Siva

View solution in original post

2 REPLIES 2

J Siva
Tera Sage

Hi @VijayKummamuru 

Always UI policies will have higher priority because UI policies will execute after form loading where as Client scripts will execute with form loading.

Now the reason why your client script is not working is because of "Make fields read-only on close" UI policy on Incident table.

As per that UI policy, the state field becomes read-only, only when the state is closed or cancelled.

To achieve your requirement, you need to either deactivate the ui policy or create new ui policy under incident table.

 

Hope this helps.

Regards,

Siva

Thanks @J Siva