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);
}