The CreatorCon Call for Content is officially open! Get started here.

Need UI policy to check Related List

Maria DeLaCruz
Tera Guru

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

1 REPLY 1

Harish Murikina
Tera Guru

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.