简体   繁体   中英

CRM 2011 javascript get child entity ID's(1:N relationship)

I need to get child entity(B) ID's from parent entity(A) and use these ID's to get child field values using javascript.

check image

I know, how to retrieve field value, when i have lookup field(N:1) on the entity using xrmservicetoolkit, but not for 1:N relationship.

Can someone help me?

I have used CRM REST builder to generate this code snippet. Basically I am retrieving Fax & FirstName of all the Contacts filtered by AccountId , as Account has 1:N relation with Contact

v1.5.0.0 support crm 2011.

XrmServiceToolkit.Rest.RetrieveMultiple("ContactSet", "?$select=Fax,FirstName&$expand=contact_customer_accounts&$filter=contact_customer_accounts/AccountId eq (guid'7DD7EE05-FC52-E811-A960-000D3A1A941E')", function(results) {
    for (var i = 0; i < results.length; i++) {
        var fax = results[i].Fax;
        var firstName = results[i].FirstName;
    }
}, function(error) {
    Xrm.Utility.alertDialog(error.message);
}, function() {
    //On Complete - Do Something
}, true);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM