Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

Dynamic Filter

SaurabhAgarwal
Giga Contributor

 Dynamic Filter - "My contact relationships"
It is refering to "new sn_cs_queryrules.AccountQueryRuleUtil().getAccountsFromContactRelationship();" this function call but when we checked "AccountQueryRuleUtil()", it do not have "getAccountsFromContactRelationship()" method on it.

Please help to understand.

1 ACCEPTED SOLUTION

Rakesh_M
Mega Sage

Hi @SaurabhAgarwal ,
1.AccountQueryRuleUtil does not implement getAccountsFromContactRelationship() directly. Instead, it extends the global.Account Script Include.

Rakesh_M_0-1785951991721.png

2.Again the Account Script Include also does not implement this method directly. It extends AccountImpl

Rakesh_M_1-1785952076062.png

3.The getAccountsFromContactRelationship() method is defined in AccountImpl.

Rakesh_M_2-1785952202188.png

 

4.This is an example of Script Include inheritance in ServiceNow. Methods defined in the parent Script Include are inherited by child Script Includes, Therefore, it is available to both Account and AccountQueryRuleUtil through the inheritance chain. 
This is why new sn_cs_queryrules.AccountQueryRuleUtil().getAccountsFromContactRelationship() works even though the method isn't explicitly present in AccountQueryRuleUtil.

View solution in original post

1 REPLY 1

Rakesh_M
Mega Sage

Hi @SaurabhAgarwal ,
1.AccountQueryRuleUtil does not implement getAccountsFromContactRelationship() directly. Instead, it extends the global.Account Script Include.

Rakesh_M_0-1785951991721.png

2.Again the Account Script Include also does not implement this method directly. It extends AccountImpl

Rakesh_M_1-1785952076062.png

3.The getAccountsFromContactRelationship() method is defined in AccountImpl.

Rakesh_M_2-1785952202188.png

 

4.This is an example of Script Include inheritance in ServiceNow. Methods defined in the parent Script Include are inherited by child Script Includes, Therefore, it is available to both Account and AccountQueryRuleUtil through the inheritance chain. 
This is why new sn_cs_queryrules.AccountQueryRuleUtil().getAccountsFromContactRelationship() works even though the method isn't explicitly present in AccountQueryRuleUtil.