Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
  2. <entity name="account">
  3. <attribute name="name" />
  4. <attribute name="primarycontactid" />
  5. <attribute name="telephone1" />
  6. <attribute name="accountid" />
  7. <attribute name="address1_city" />
  8. <order attribute="name" descending="false" />
  9. <link-entity name="contact" from="parentcustomerid" to="accountid" alias="ac">
  10. <attribute name="address1_city" />
  11. </link-entity>
  12. </entity>
  13. </fetch>
  14.  
  15. =Fields!address1_city.Value="Sydney" Or Fields!ac_address1_city.Value="Sydney"
  16.  
  17. string fetchXml = string.Empty;
  18. var query = context.InputParameters["Query"] as QueryExpression;
  19. var fetchQuery = context.InputParameters["Query"] as FetchExpression;
  20.  
  21. if (query == null)
  22. {
  23. if (fetchQuery == null)
  24. {
  25. return;
  26. }
  27. fetchXml = fetchQuery.Query;
  28. }
  29.  
  30. // Convert query to a fetch expression for processing and apply filter
  31. else
  32. {
  33. fetchXml =
  34. ((QueryExpressionToFetchXmlResponse)
  35. service.Execute(new QueryExpressionToFetchXmlRequest {Query = query})).FetchXml;
  36. }
  37.  
  38. if (fetchXml.Contains(OpportunityFilterGuid))
  39. {
  40. ApplyFilter(context, service, query);
  41. }
  42. }
  43.  
  44. collectionOne.Entities.GroupBy(oppId => oppId.Id).Select(opp => opp.First())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement