Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

I want to make the change order task read only.

Gulfam
Tera Guru

I want to make the order field of "Change Task" read only. It should be editable only for "Assigned to" of "Change Request". 

4 REPLIES 4

Not applicable

Hi @Gulfam 

 

Please try following client script-

 

function onChangeAssignedTo() {
    var assignedTo = g_form.getValue('assigned_to'); 
    var changeRequestId = g_form.getValue('change_request');
    var changeRequestGr = new GlideRecord('change_request');
    changeRequestGr.get(changeRequestId);
    if (assignedTo === changeRequestGr.getValue('assigned_to')) {
        g_form.setReadOnly('order', false);
    } else {
        g_form.setReadOnly('order', true);
    }
}

Please mark my answer helpful and correct.

 

Regards,

Amit

Gulfam
Tera Guru

Hi Amit, 

 

Thank you for quick response. 
This order field is related to change task. 

Not applicable

You can write above script on change task table only

Hi Amit, 

 

But the assigned to field is related to Change Request. Change task can be assign to any user. 
There is no such condition that assigned to on change task is the same person as assigned to on change request.