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.

Why is the cmdb_ci field still editable when it should not be?

lonesoac01
Giga Guru

I am trying to troubleshoot why the cmdb_ci field is still editable  after I apply "Run If False" code in a UI Policy.

 

Here is my Run if True code:

function onCondition() {
    if (g_user.hasRole('usb_unauth_change_manager') || g_user.hasRole('change_manager')) {
        g_form.setReadOnly('cmdb_ci', false);
        g_form.setReadOnly('short_description', false);
		//alert("Andrew Wuz Here 1");
    } else {
        g_form.setReadOnly('cmdb_ci', true);
        g_form.setReadOnly('short_description', true);
		//alert("Andrew Wuz Here 2");
    }
}

Here is my run if false code:

function onCondition() {
    if (g_user.hasRole('usb_unauth_change_manager') || g_user.hasRole('change_manager')) {
        g_form.setReadOnly('cmdb_ci', true);
        g_form.setReadOnly('short_description', true);
		alert("Andrew Wuz Here 3");
    } else {
        g_form.setReadOnly('cmdb_ci', false);
        g_form.setReadOnly('short_description', false);
		//alert("Andrew Wuz Here 4");
    }
}

 

The alert dialog for "Andrew Wuz Here 3" appears fine.  What is overriding my readonly lines?

5 REPLIES 5

The points from my original reply are still valid - you likely have a Data Policy or Client Script on the same table affecting this field.