How to make a related list that has a custom UI Policy Related List to be mandatory?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 07:04 PM
Dear experts,
I am facing a situation where I want to make a Business Rule for my custom related list tables to be mandatory, but I have three custom related list tables that has three different UI Policy Related List defined for them, for example, if a choice in the risk event record is selected, third-party is selected for the field, then the third-party custom related list table will show only, the other two tables will not show. How do I make a business rule that will only work on the related list that is appearing and make it have at least one record inserted. If the other two related list tables are not showed is not, then it won't trigger the business rule. The business rule will only trigger on the related list that appears based on the UI Policy related list action defined. Please advise on how should I approach this. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 07:25 PM - edited 05-29-2025 07:27 PM
Hi @ChuanYanF
unfortunately your question is confusing as it is not clear how the mentioned "Business Rule" is related to the shown "UI Policies"! Are you mixing the topics?
And apart from this: A Business Rule is completely independent of any client-side configurations like UI Policies! A Business Rule works on server-side and has no idea about any client-side configurations!
So again: Your question is pretty confusing!
Maik
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 09:03 PM
Hi Maik, sorry for the confusion, as in I have three custom related list tables that will appear based on the fields selected in the risk event form, so this part is configured using UI Policy. But to make a related list mandatory for my knowledge here is the only way is to use Business Rule before insert or before update right? So that is where this Business Rule questioned came up, currently this is my business rule script.
(function executeRule(current, previous /*null when async*/) {
// Get the selected party
var partyValue = current.u_parties_involved_in_affected_by_the_event;
// If party value is empty, do nothing
if (!partyValue)
return;
// If 1 or 3, check for Customer Involved
if (partyValue == 1 || partyValue == 3) {
var customer = new GlideRecord("sn_risk_advanced_customer_info_breached_customer_s_involved_affected");
customer.addQuery("u_risk_event", current.sys_id);
customer.query();
if (!customer.next()) {
gs.addInfoMessage("Please add at least one Customer Involved record.");
action.setRedirectURL(current);
current.setAbortAction(true);
return;
}
}
// If 2, check for Staff
if (partyValue == 2) {
var staff = new GlideRecord("sn_risk_advanced_customer_info_breached_staff");
staff.addQuery("u_risk_event", current.sys_id);
staff.query();
if (!staff.next()) {
gs.addInfoMessage("Please add at least one Staff record.");
action.setRedirectURL(current);
current.setAbortAction(true);
return;
}
}
// If 3, also check for Third Party
if (partyValue == 3) {
var thirdParty = new GlideRecord("sn_risk_advanced_customer_info_breached_third_party_service_provider");
thirdParty.addQuery("u_risk_event", current.sys_id);
thirdParty.query();
if (!thirdParty.next()) {
gs.addInfoMessage("Please add at least one Third Party Service Provider record.");
action.setRedirectURL(current);
current.setAbortAction(true);
return;
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 11:07 PM
Hi @ChuanYanF
sorry, I'm still confused and have no idea what you mean with with "to make a related list mandatory for my knowledge".
Can you please stop asking for certain solutions and really explain first in your own words what the requirement is? A related list is just a list of records! It cannot be mandatory anywhere. So what exactly do you want to achieve?
Maik