MS CRM 2011- Fetch method.
-
miércoles, 18 de abril de 2012 14:47
Hi,
In CRM 4.0 we had a Fetch() method that returned the result of a fetchxml query as xml formatted string. Is this method depricated in CRM 2011? I know that i could serialize a object or build the xml myself, but im looking for the same method that gives the same result as the "old fetch" to simplify an upgrade from 4.0 to 2011.
Update:I can still use the FetchXmlResult property on the ExecuteFetchResponse object. But this is marked as depricated. :(
Is there any alternative that will give me the same result?
Thanks,
Srikanth Reddy
Todas las respuestas
-
miércoles, 18 de abril de 2012 15:18
You can use FetchXML as a Query for RetrieveMultiple requests.
-
jueves, 26 de abril de 2012 14:57
RetrieveMultipleRequest req = new RetrieveMultipleRequest(); FetchExpression fetch = new FetchExpression(fetchQuery); req.Query = fetch; RetrieveMultipleResponse resp = (RetrieveMultipleResponse)service.OrgServiceProxy.Execute(req);
-
jueves, 26 de abril de 2012 18:58
//The fetch xml query we want to execute string fetchquery = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" + "<entity name='account'>" + "<attribute name='name' /> " + "<attribute name='address1_city' /> " + "<attribute name='primarycontactid' /> " + "<attribute name='telephone1' /> " + "<attribute name='accountid' /> " + "<order attribute='name' descending='false' /> " + "<filter type='and'>" + "<condition attribute='statecode' operator='eq' value='0' /> " + "</filter>" + "<link-entity name='contact' from='contactid' to='primarycontactid' visible='false' link-type='outer' alias='accountprimarycontactidcontactcontactid'>" + "<attribute name='emailaddress1' /> " + "</link-entity>" + "</entity>" + "</fetch>"; RetrieveMultipleRequest req = new RetrieveMultipleRequest(); FetchExpression fetch = new FetchExpression(fetchquery); req.Query = fetch; RetrieveMultipleResponse resp = (RetrieveMultipleResponse)service.Execute(req);
Please check one of my Favorite MVP blog
http://mileyja.blogspot.com/2011/06/use-fetchxml-queries-in-jscript-and-net.htmlI hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
Mubasher Sharif
Check out my about.me profile!
http://mubashersharif.blogspot.com
Linked-In Profile
Follow me on Twitter! -
lunes, 17 de septiembre de 2012 13:31
Hi,
We are also facing the same issue. We are accesing the dcrm online from java. Earlier we were using the fetch method to retrieve data. But with DCRM online, how can I get the result in xml formatted string as earlier.
Here is the sample output that we got in dcrm4 when we call fetch() method.
<resultset morerecords="0" paging-cookie="<cookie page="1"><contactid last="{F7EA50D7-4208-E111-BAB6-005056AF16B3}" first="{F7EA50D7-4208-E111-BAB6-005056AF16B3}" /></cookie>"><result><customersizecode name="Default Value" formattedvalue="1">1</customersizecode><owningbusinessunit>{262A3BE5-72B9-DE11-810F-000C29286BC8}</owningbusinessunit></result></resultset>
Now we are using OrganizationService and not able to get the output xml directly. We have to loop thru attributecollection and formattedvaluecollection and build the xml. Is there any way by which we can get this xml directly(as it was earlier) instead of building it manually.
Thank you.
Regards
- Kiran