How to show the child/sub-account and parent account related KB articles when we select child accoun

sugand
Tera Contributor

Hi,

Have a requirement that whenever a sub-account or child account is selected on the incident form, we should show all the related KB articles corresponding to that child account and parent account. 

 

Have attached the screenshots for your understanding. Kindly help me with the script for the same.

sugand_0-1695898113441.png

sugand_1-1695898134521.png

sugand_2-1695898153098.png

sugand_3-1695898170203.png

 

 

Thanks,

Sugan

3 REPLIES 3

Peter Bodelier
Giga Sage

Hi @sugand 

 

If you navigate to ‘System Definition -> Relationships’ and create a new relationship record, use the following script:

 

 

 

(function refineQuery(current, parent) {

current.addQuery('<<your company field name on kb_knowledge>>', parent.sys_id).addOrCondition('<<your company field name on kb_knowledge>>', parent.parent);

})(current, parent);

 

Applies to table Account or Company

Queries from table Knowledge Article


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Hi, 

The actual requirement is all the related knowledge articles of customer account and site (custom table) should show when the sub-account is selected. (all the kb articles of sub-account, parent account should also be shown).

 

Can you pls correct the script by adding recursive function.

 

sugand_0-1695913549618.png

sugand_1-1695913561377.png

 

 

Thanks,

Peter Bodelier
Giga Sage

Not really sure what is set up here, but I guess, you could accomplish it by extending line 8:

acc.addQuery('u_customer_account',current.u_site.u_account.sys_id).addOrCondition('u_customer_account', u_customer_account',current.u_site.u_account.parent);

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.