How to make a field both mandatory and read-only and that field type is Single line text i.e "Please provide LineID to be transferred" and this field value is auto populated based on user and this field is visible when we select this field as "Does t

Atchamma D
Tera Contributor

3 REPLIES 3

Voona Rohila
Mega Patron
Mega Patron

Hi Atchamma

Can you share the image again and provide more details on your requirement.

Also, we cannot make field both mandatory and read only, 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

suvro
Mega Sage

We cannot make a field a read-only and mandatory together. If you are planning to populate that via script. Then do not make it mandatory.

You can write an onSubmit client script to check whether the field has value and abort the action if it is blank

if (g_form.getValue('field_name') == ''){

return false;

}

Yousaf
Giga Sage

Hi Atchamaa,

Yes You can set the fields both mandatory and Read-only for further details refer to this link:
https://community.servicenow.com/community?id=community_question&sys_id=f43dca1fdb6a3b00e0e80b55ca96...

Mark Correct or Helpful if it helps.

Thanks,
Yousaf


***Mark Correct or Helpful if it helps.***