locked
Unable to get Active Contact Records Count from Marketing List RRS feed

  • Question

  • Hello Experts,

    My requirement is to get only Active Contact records count when a Contact is associated with Marketing List and show it in a Integer field. 

    I am using below Odata Query, but i am not getting any result. Is anything wrong with the below or is there any better approach to achieve this? 

    http://<Server URL>/<Org Name>/xrmservices/2011/OrganizationData.svc/ListSet?$select=listcontact_association/StateCode&$expand=listcontact_association&$filter=ListId eq guid'<Guid>' & listcontact_association/any(a:a/StateCode/Value eq '0')

    Please help.


    Arun Potti


    • Edited by Arun Potti Sunday, September 4, 2016 5:55 PM Change is Title
    Sunday, September 4, 2016 5:52 PM

All replies

  • Hi Arun,

    You can use query designer tool to create this type of query.

    https://crm2011odatatool.codeplex.com/

    Thanks

    Monday, September 5, 2016 9:07 AM
  • I have generated the same Odata Query using Odata Query Designer Tool. But that query is not giving the right result.

    Arun Potti

    Monday, September 5, 2016 11:03 AM
  • I tested the query like below and its working.

    http://../2011/OrganizationData.svc/
    ListSet?$select=listcontact_association/StateCode&$expand=listcontact_
    association&$filter=ListId ne null and StateCode/Value eq 0

    But i am not able to set filter with listcontact_assciation as you mentioned in your query. Try by removing this filter also replace & sign with 'and' as mentioned in bold.

    http://<Server URL>/<Org Name>/xrmservices/2011/OrganizationData.svc/ListSet?$select=listcontact_association/StateCode&$expand=listcontact_association&$filter=ListId eq guid'<Guid>' and StateCode/Value eq '0'

    Thanks



    Monday, September 5, 2016 12:04 PM