{"id":67,"date":"2012-03-13T10:53:00","date_gmt":"2012-03-13T10:53:00","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=67"},"modified":"2012-03-13T10:53:00","modified_gmt":"2012-03-13T10:53:00","slug":"nn-association","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2012\/03\/nn-association\/","title":{"rendered":"N:N association"},"content":{"rendered":"<div>\n<div><span>When we have to associate the records we normally use AssociateRequest but while associating campaign with campaign related items such as <strong>Campaign, Marketing List, Product, or Salesliterature<\/strong> <\/span><span>it doesn\u2019t work.<\/p>\n<p>For achieving this we have special Message made for Campaign called <strong>AddItemCampaignRequest<\/strong>.<br \/>Below we have provided the code that will associate the Campaign with Campaign Items.<\/p>\n<p>          \/\/Add Item to Campaign                      <br \/>                                   AddItemCampaignRequest req = new AddItemCampaignRequest();<\/p>\n<p>        \/\/ Specify the Campaign Id<br \/>                       req.CampaignId = new Guid(CampaignId)<\/p>\n<p>        \/\/ Specify the Logical name of the entity to which we want the Campaign to be associated<br \/>                       req.EntityName = entity.LogicalName;<\/p>\n<p>        \/\/ Specify the Id of the entity to which we want Campaign to be associated<br \/>                        req.EntityId = new Guid(EntityId)<\/p>\n<p>        \/\/ Execute the request               <br \/>AddItemCampaignResponse resp = (AddItemCampaignResponse)_service.Execute(req);<\/p>\n<p>We can associate Campaign, Marketing List, Product, <\/span><span>or Salesliterature w<\/span><span>ith the Campaign through the AddItemCampaignRequest message.<\/span><\/div>\n<div><span>To use this message, pass an instance of the <strong>AddItemCampaignRequest<\/strong><\/span><span><strong> <\/strong>class as the request parameter in the <\/span><span>Execute<\/span><span> method. To perform this action, the caller must have <\/span><span>access rights<\/span> <span>on the campaign entity instance.<\/span><\/div>\n<div><span>Same we can associate the Campaign Activities with the Marketing Lists through the  AddItemCampaignActivityRequest as given in the below code.<\/span><\/div>\n<div><span>\/\/ Create the request object.<br \/>AddItemCampaignActivityRequest add = new AddItemCampaignActivityRequest();<\/p>\n<p>\/\/ Set the properties of the request object.<br \/>add.CampaignActivityId = new Guid(CampaignActivityId);<\/p>\n<p>\/\/ Specify the List Id to which we want Campaign Activity to be associated<br \/>add.ItemId = new Guid(listId);<\/p>\n<p>\/\/ Specify the Logical name of the entity to which we want the Campaign Activity to be associated<br \/>add.EntityName = EntityName.list;<\/p>\n<p>\/\/ Execute the request.<br \/>AddItemCampaignActivityResponse added = (AddItemCampaignActivityResponse) service.Execute(add);<\/p>\n<p>The Marketing List being added must have already been added to the campaign otherwise error will be thrown and Marketing List will not be associated with Campaign Activities.<br \/><\/span><span><br \/>Hope this helps!!!<\/span><\/div>\n<p><span><\/span><\/div>\n","protected":false},"excerpt":{"rendered":"<p>When we have to associate the records we normally use AssociateRequest but while associating campaign with campaign related items such as Campaign, Marketing List, Product, or Salesliterature it doesn\u2019t work. For achieving this we have special Message made for Campaign called AddItemCampaignRequest.Below we have provided the code that will associate the Campaign with Campaign Items.\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2012\/03\/nn-association\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[19],"tags":[153,1244],"class_list":["post-67","post","type-post","status-publish","format-standard","hentry","category-dynamics-crm","tag-associate-campaign-with-marketing-list","tag-nn-association"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/67","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=67"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/67\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}