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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 05:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 05:47 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 05:51 AM
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;
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 06:12 AM
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.***