Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

how to retrieve related entity data from the current entity using javascript rest service

Posted on by Microsoft Employee

hi,

i have a requirement.I have 2 entities .When i am working on  current entity i want to retrieve the records from related entity.How can i retrieve using javascript rest service?

i used this code but getting error

var countryid;
var countrypopulation;
function GetSelectedCountryId()
{
//catching selected lookup id
countryid=Xrm.Page.getAttribute("tj_countryname").getValue()[0].id;
}
function CopyPopulation()
{
//retrieving the data by passing lookup id
XrmServiceToolkit.Rest.Retrieve(countryid,"tj_countrySet",function(columns)
{
//catching parent entity population attribute data
countrypopulation=columns.tj_population;
},
function(error)
{
alert(error.message);
},
false
);
}
function UpdatePopulation()
{
//updating the population field in the current entity
Xrm.Page.getAttribute("tj_population").setValue(countrypopulation);
}

*This post is locked for comments

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: how to retrieve related entity data from the current entity using javascript rest service

    Hi,

    You can use rest builder for your query

    Here is sample how to use it: jlattimer.blogspot.in/.../crm-rest-builder-2300-now-with-web-api.html

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans