Need UI policy to check Related List
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2015 12:57 PM
Hi,
I need a UI policy to make a certain field on the Change form mandatory when the Related List for "Incidents Pending Change" is not empty. How would I write the condition for the Related List? Please help.
Thanks,
Maria

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2015 06:34 PM
For this what you can do is write ondsiplay business rule on change table.
by using
var count = 0;
var getpendinginc = new GlideRecord(incident');
getpendinginc.addQuery('rfc', current.sys_id);
getpendinginc.query();
count = getpendinginc.getRowCount();
g_scratchpad.incpendingchanges = count;
In ui policy
_____________-
Dont give any condition for the policy and it should run every time when the form loads
get the scratcpad value
var ispendingchangesexist = g_scratchpad.incpendingchanges;
alert(ispendingchangesexist)
if(ispendingchangesexist > 0) // suppose if it gives more than 0 means some incidents are exist on the related list
{
write code to make fields mandatory
}
Regards,
Harish.