locked
How to get Campaign Activity Marketing List using OData query to Campaign Activity RRS feed

  • Question

  • Hello Devs,

    How can I get campaign activity marketing list (related) records in an OData query call to CampaignActivitySet? like this:

    https://<servername>/xRMServices/2011/OrganizationData.svc/CampaignActivitySet

    ?&$expand=CampaignActivity_CampaignActivityItems

    &$select=CampaignActivity_CampaignActivityItems

    Above query returns with error:

    'Microsoft.Crm.Sdk.Data.Services.CampaignActivity' does not have a property named 'CampaignActivity_CampaignActivityItems

    However, I can get CampaignActivity_Tasks (related records) successfully.

    The reason for this seems that this relation is not exposed in the 1:N Relationships of the Campaign Activity. Is there any way to achieve the same. 

    I can get the marketing list records in another OData query call (/CampaignActivityItemSet) but I need this in a single trip to server side.


    blog: http://technologynotesforyou.wordpress.com | skype: ali.net.pk


    • Edited by Khadim Ali Tuesday, November 10, 2015 8:51 AM title clarification
    Tuesday, November 10, 2015 8:39 AM

Answers

  • Hi,

    As far as i know you can only fetch related n:1 records in one query. You can not fetch 1:n and N:N records. Why Don't you use fetchXml? You can go multi level.

    Use xrmservicetoolkit.

    Thanks!

    Kalim Khan

    • Marked as answer by Khadim Ali Thursday, November 12, 2015 11:57 AM
    Tuesday, November 10, 2015 1:12 PM

All replies

  • Hi,

    As far as i know you can only fetch related n:1 records in one query. You can not fetch 1:n and N:N records. Why Don't you use fetchXml? You can go multi level.

    Use xrmservicetoolkit.

    Thanks!

    Kalim Khan

    • Marked as answer by Khadim Ali Thursday, November 12, 2015 11:57 AM
    Tuesday, November 10, 2015 1:12 PM
  • Hi,

    As far as i know you can only fetch related n:1 records in one query. You can not fetch 1:n and N:N records. Why Don't you use fetchXml? You can go multi level.

    Use xrmservicetoolkit.

    Thanks!

    Kalim Khan

    Just to correct, we may expand the OData query using 1:N relatioship. I have tested with CampaignActivity_Tasks relationship.

    Anyways, the fetchXml was a good alternate for this. Thanks.


    blog: http://technologynotesforyou.wordpress.com | skype: ali.net.pk

    Thursday, November 12, 2015 12:00 PM