Tag Archives: Additem

Microsoft Dynamics CRM 2013 – Plugin Messages – AddItem – deep dive

SdkMessage.Name SdkMessageRequest.Name SdkMessage.CategoryName
AddItem AddItemCampaignActivity None

The AddItem Message is called when you add a marketinglist to a marketing campaign.

What happens when you add a marketinglist to a campaign…

05.10.2013 11:18:47.992 :: INFO :: Entity: list => Message: Retrieve => Stage: 10
05.10.2013 11:18:47.993 :: INFO :: Entity: list => Message: Retrieve => Stage: 20
05.10.2013 11:18:47.996 :: INFO :: Entity: list => Message: Retrieve => Stage: 40
05.10.2013 11:18:47.998 :: INFO :: Entity: campaign => Message: AddItem => Stage: 10
05.10.2013 11:18:47.999 :: INFO :: Entity: campaign => Message: AddItem => Stage: 20
05.10.2013 11:18:48.010 :: INFO :: Entity: list => Message: Update => Stage: 20
05.10.2013 11:18:48.015 :: INFO :: Entity: list => Message: Update => Stage: 40
05.10.2013 11:18:48.017 :: INFO :: Entity: campaign => Message: AddItem => Stage: 40

05.10.2013 11:18:48.040 :: INFO :: Entity: list => Message: Retrieve => Stage: 10
05.10.2013 11:18:48.041 :: INFO :: Entity: list => Message: Retrieve => Stage: 20
05.10.2013 11:18:48.044 :: INFO :: Entity: list => Message: Retrieve => Stage: 40
05.10.2013 11:18:48.046 :: INFO :: Entity: campaign => Message: AddItem => Stage: 10
05.10.2013 11:18:48.048 :: INFO :: Entity: campaign => Message: AddItem => Stage: 20
05.10.2013 11:18:48.057 :: INFO :: Entity: list => Message: Update => Stage: 20
05.10.2013 11:18:48.062 :: INFO :: Entity: list => Message: Update => Stage: 40
05.10.2013 11:18:48.065 :: INFO :: Entity: campaign => Message: AddItem => Stage: 40

05.10.2013 11:18:48.119 :: INFO :: Entity: list => Message: RetrieveMultiple => Stage: 10
05.10.2013 11:18:48.123 :: INFO :: Entity: list => Message: RetrieveMultiple => Stage: 20
05.10.2013 11:18:48.128 :: INFO :: Entity: list => Message: RetrieveMultiple => Stage: 40

05.10.2013 11:18:48.143 :: INFO :: Entity: list => Message: RetrieveMultiple => Stage: 10
05.10.2013 11:18:48.147 :: INFO :: Entity: list => Message: RetrieveMultiple => Stage: 20
05.10.2013 11:18:48.152 :: INFO :: Entity: list => Message: RetrieveMultiple => Stage: 40

First the marketing list is retrieved (Stage 10-20-40 => pre Validation, pre Operation and post Operation).

Then the AddItem message is triggered and the marketing list is added to the campaign (Stage 10-20).
Within this process the marketing list is updated (Stage 20-40 => there is no pre validation stage ?!) and the “last used on” date value is set.

The next retrievemultiple messages are used to display the related marketing lists. The question is – why two times ?

Debugging shows the content of the first and second fetchxml:

<fetch distinct="false" no-lock="true" mapping="logical" page="1" count="4" returntotalrecordcount="true">
<entity name="list">
<attribute name="membercount" />
<attribute name="listname" />
<attribute name="listid" />
<attribute name="listname" />
<attribute name="membercount" />
<order attribute="listname" descending="false" />
<link-entity name="campaignitem" to="listid" from="entityid" link-type="inner">
<link-entity name="campaign" to="campaignid" from="campaignid" link-type="inner">
<filter type="and">
<condition attribute="campaignid" operator="eq" value="{CCD0CE13-9C2D-E311-B696-000C2926DDE4}" />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch>
<fetch distinct="false" no-lock="true" mapping="logical" page="1" count="250" returntotalrecordcount="true">
<entity name="list">
<attribute name="listname" />
<attribute name="createdfromcode" />
<attribute name="type" />
<attribute name="lastusedon" />
<attribute name="purpose" />
<attribute name="listid" />
<attribute name="listname" />
<attribute name="type" />
<attribute name="createdfromcode" />
<attribute name="lastusedon" />
<attribute name="purpose" />
<order attribute="listname" descending="true" />
<link-entity name="campaignitem" to="listid" from="entityid" link-type="inner">
<link-entity name="campaign" to="campaignid" from="campaignid" link-type="inner">
<filter type="and">
<condition attribute="campaignid" operator="eq" value="{CCD0CE13-9C2D-E311-B696-000C2926DDE4}" />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch>

Of course the AddItem message is also triggered if you add a campaign activity to a campaign which already has related marketing lists.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>