Dynamic filter to get One of my child accounts / companies

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2020 07:37 PM
OOB there is a dynamic filter to get one of my company.
This filter uses the function getCompanyID(), which returns the company of the login user.
To be used in reports on Case, how to get my account as well as child accounts tagged to my account
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2020 11:59 PM
Hi, you may need to clarify exactly what you mean by 'child accounts tagged to my acccount'. Does 'my account' mean the company assigned/applied to your user record? If yes, then I don't recall the company table having a parent/child relationship OOB? What is your parent/child relationship? and what is the context of 'tagged'

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2020 05:26 PM
Parent / Child Account is defined as shown below
Refer to the column "Parent Account"
Impersonate Julie Lewis,
Go to Case -> Add filter -> Account (is) One of My Accounts
Expected:
All the BOXEO accounts are added in the filter
Julie is able to see the cases raised for ALL Boxeo accounts
The below script returns the expected list of accounts:
var childAccount = [];
var loginCompany = '';
var getMyAccount = new GlideRecord('sys_user');
getMyAccount.addQuery('sys_id', gs.getUserID());
getMyAccount.query();
if (getMyAccount.next()) {
loginCompany = getMyAccount.company;
}
var getParentChildAccount = new GlideRecord('customer_account');
getParentChildAccount.addEncodedQuery('account_parent=' + loginCompany + '^ORsys_id=' + loginCompany);
getParentChildAccount.query();
while (getParentChildAccount.next()) {
childAccount.push(getParentChildAccount.sys_id);
}
return childAccount;
Dynamic Filter is setup as shown below
Result:
In Case table, i see the filter is showing as empty