- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 03:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 04:10 AM
Hi,
In order to make the Related List Mandatory i.e. checking if any record is present in the Related List or not we can make use of an Before Update Business Rule and Abort the Form Submission as required. Please follow the below steps:
1) For Example On the Incident Form, I have the Problem Related List and say based on certain condition you want to check whether the Problem Related List has Records attached or not whether a New one or an existing one then we can have the below script and make the Related List as a mandate one:
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var prb = new GlideRecord("problem");
prb.addEncodedQuery("parent=" + current.sys_id);
prb.query();
if(!prb.next())
{
gs.addInfoMessage("Please link a Problem Record at the bottom Probem Tab");
action.setRedirectURL(current);
current.setAbortAction(true);
}
})(current, previous);
Result:
If the User tries to Update the Record without attaching the Problem Record it aborts the form submission with the Invalid Update Error as shown below:
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 03:47 AM
Refer below threads may helpful to you.
Make entry in related list mandatory
how to make a field mandatory, if entry is made in related list..?
make related list tab mandatory
ServiceNow Commnunity MVP -2018 class.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 03:50 AM
Hi,
You will be able to do this via a data policy on the table of the embedded list - you will however not be able to see the mandatory fields visually in the embedded list it self, as UI policies are not evaluated in list views - you will however get a Data Policy Exception when saving the form, if the mandatory fields have not been filled out.
So it is not so user friendly.
The data policy it self, can include values from the parent record in its condition to determine when the fields should be mandatory.
Here is an example where I have created a simple table which has a reference to the incident table, and one of the fields are mandatory, based on a condition which looks at both the parent incident, and the embedded table it self.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 03:53 AM
Hi,
What is the exact requirement?
But you can find the answer here,
You may need to create a script include and client script.
Make entry in related list mandatory
Thanks,
Vinitha.K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 04:07 AM