Quantcast
Channel: Microsoft Dynamics CRM
Viewing all articles
Browse latest Browse all 123975

Blog Post: Associating Marketing Lists and Campaigns

$
0
0

I ran across an unusual SDK topic last week that I thought I would share.

I need to associate a Campaign with a Marketing List.  This should be a pretty simple Associate operation but it turns out, if you try to use the standard Associate Request, like one of these three methods (all of which I know to be perfectly valid):

var request1 = new AssociateEntitiesRequest     {         Moniker1 = new EntityReference(Campaign.EntityLogicalName, campaignId),         Moniker2 = new EntityReference(List.EntityLogicalName, marketingListId),         RelationshipName = "campaignlist_association"     };  
var request2 = new AssociateRequest {     Target = new EntityReference(List.EntityLogicalName, marketingListId),     RelatedEntities = new EntityReferenceCollection         {             new EntityReference(Campaign.EntityLogicalName, campaignId)         },     Relationship = new Relationship("campaignlist_association") };
 
service.Associate(         Campaign.EntityLogicalName, campaignId,         new Relationship("campaignlist_association"),         new EntityReferenceCollection             {                 new EntityReference(List.EntityLogicalName, marketingListId)             });  

 

These requests actually produce a really strange error message:

Associate is not supported for CampaignItem Platform

 

After digging around for quite a while, I finally found this article, by Rajeev Pentyala, which shows a JavaScript version of the solution I need.

This is the correct code segment to perform this operation in C#:

var request = new AddItemCampaignRequest {     CampaignId = campaignId,     EntityId = marketingListId,     EntityName = List.EntityLogicalName, };

                       

Viewing all articles
Browse latest Browse all 123975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>