Created
February 28, 2020 11:14
-
-
Save melamriD365/47e245075e70054fb8e84aebbdee8566 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function DisplayAllChildAccounts(executionContext) { | |
var formContext = executionContext.getFormContext(); | |
var accountId = formContext.data.entity.getId(); | |
var childAccountGridContext = formContext.getControl("ChildAccounts"); | |
if (childAccountGridContext == null) { | |
setTimeout(function () { getAllChildAccounts(executionContext); }, 2000); | |
} | |
else { | |
var fetchData = { | |
accountid: accountId | |
}; | |
var fetchXml = [ | |
"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>", | |
" <entity name='account'>", | |
" <attribute name='name' />", | |
" <attribute name='telephone1' />", | |
" <attribute name='address1_city' />", | |
" <attribute name='primarycontactid' />", | |
" <attribute name='statecode' />", | |
" <order attribute='name' descending='false' />", | |
" <filter type='and'>", | |
" <condition attribute='accountid' operator='under' value='", fetchData.accountid, "'/>", | |
" </filter>", | |
" </entity>", | |
"</fetch>", | |
].join(""); | |
console.group(fetchXml); | |
childAccountGridContext.setFilterXml(fetchXml); | |
childAccountGridContext.refresh(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment