Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Set lookup value obtained from fetchxml result to a field using javascript

$
0
0

Hi everyone,

I have a requirement where I have to set the value obtained from a fetchxml query to a lookup field. 

I have assigned the fetchxml query result to a variable using the syntax, 

Xrmservicetoolkit.SOAP.fetch.

Here is my code,

// Fetch XML query to retrieve client record based on the member value through the link entity Member Client Association

var fetchXml = "<fetch distinct='true' mapping='logical' output-format='xml-platform' version='1.0'>" +
"<entity name='account'>" + "<attribute name='name'/>" + "<attribute name='primarycontactid'/>" + "<attribute name='telephone1'/>" + "<attribute name='accountid'/>" +
"<order descending='false' attribute='name'/>" + "<link-entity name='pomco_membercli' alias='ab' to='accountid' from='pomco_clients'>" +
"<filter type='and'>" + "<condition attribute='pomco_member1' value='" + memberId + "' uitype='memType' uiname='memName' operator='eq'/>" +
"</filter>" + "</link-entity>" + "</entity>" + "</fetch>";

var clientRecords = XrmServiceToolkit.Soap.Fetch(fetchXml);
alert(clientRecords);

var iD= clientRecords[0].id;
alert(iD);

Currently, I am able to obtain the GUID, but not the name and the entity type. 

Can anyone help me, how to pass the result and set it to a field.

Thanks in advance!


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images