Standard Change Properties Unable to make fields read Only - function is not working

ServiceNow10sun
Giga Guru

Hi All, 

 

I am trying to make few fields ( Example -  Short Description)are read only when Model is 'STANDARD' in change request table and state is NEW  however when i am trying to  add that Short Description field in ' read only fields ' option short description is not becoming read only.

sunita10_0-1686767535721.png

Thank you in Advance.

6 REPLIES 6

Michael Fry1
Kilo Patron

I tried it and it appears to work fine for me. How are you testing it? Are you creating a new Std change from a catalog item?

Thank you for the prompt response. 

In my PDI it is working however in my Dev instance its  Standard template properties is not working. My requirement is to make all change request form as Read Only when State is New and Type is Standard . Already in instance we have UI policy to make change request form fields read only when Type is either Normal /Emergency and states are Assess/Authorize/ Schedule/Implementation/Review/Closed/Cancelled. 

 

I have even tried creating UI policy for the above requirement however One at a time UI policy is working Either the Normal/ Emergency UI policy is working or the standard change UI policy is working. 

Sid_Takali
Kilo Patron
Kilo Patron

Hi @ServiceNow10sun try this

Cause

The read-only fields for standard changes are set through a client script, "Mark standard change fields readonly". This client script gets the type of change from the form type field. If this field is not part of the change request form, due to some customization on the OOB layouts or due to using a custom layout, the client script is unable to identify the change as being standard and will not apply the standard change definitions:

var chgType = g_form.getValue("type"); 
var ga;
if (chgType == "standard") {
     if (g_form.isNewRecord()){
          ga = new GlideAjax('StdChangeUtils');
          ga.addParam('sysparm_name', 'ajaxFunction_getReadOnlyFieldsOnInsert');
          ga.getXMLAnswer(markReadonly);
     } else {
          ga = new GlideAjax('StdChangeUtils');
          ga.addParam('sysparm_name', 'ajaxFunction_getReadOnlyFields');
          ga.addParam('sysparm_sysId', g_form.getUniqueValue());
          ga.addParam('sysparm_tableName', 'change_request');
          ga.getXMLAnswer(markReadonly);
     }
}

Resolution


Adding the type field to the form will solve this issue:

  • Open any change request;
  • Click on "Additional Actions' menu on the top left or right click on the header bar;
  • Choose Configure -> Form Layout;
  • Add the "type" field to the Selected list and click Save;

You can also customize the client script "Mark standard change fields readonly" and use an alternative way to get the type of change for the record.

Please  don't forgot to reply as Helpful/Correct, if applicable.

Thanks,

Siddharam

Thank you for the prompt response. 

In my instance of change request from there is field 'Type' already. We have also not done any changes to this CS and even to the BR, however we have many UI polices on Normal and Emergency changes for the same field to become read only when states are Assess to Closed.  Will this be the reason of not working this standard change template properties?

sunita10_0-1686823860572.pngsunita10_1-1686823893948.png