domingo, 15 de septiembre de 2013

CRM 4.0 - Crear un fetch y convertirlo en un Query


CREAR UN FETCH Y CONVERTIRLO EN UN QUERY


     contact contacto = new contact();
            string fetch = @"<fetch mapping='logical'><entity name='account'><attribute name='accountid'/><filter type='and'><condition attribute = 'accountid' operator='like' value='%0B111D2-67F7-DD11-B67D-000C29F50BC0' /></filter></entity></fetch>";
            FetchXmlToQueryExpressionRequest fetchqueryreq = new FetchXmlToQueryExpressionRequest();
            fetchqueryreq.FetchXml = fetch;
            FetchXmlToQueryExpressionResponse qe = (FetchXmlToQueryExpressionResponse)crmService.Execute(fetchqueryreq);
            // Create the request.
            RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest();
            retrieve.Query = qe.Query;
     retrieve.ReturnDynamicEntities = true;
            // Execute the request.
            RetrieveMultipleResponse retrieved2 = (RetrieveMultipleResponse)crmService.Execute(retrieve);

            if(retrieved2.BusinessEntityCollection.BusinessEntities.Count>0 ){

            }

No hay comentarios:

Publicar un comentario