Note that there are some explanatory texts on larger screens.

plurals
  1. POCRM Plugin "Update" wrongly triggered on record creation "Create"
    primarykey
    data
    text
    <p>I wrote two plugins for CRM Dynamics 2011. One is configured to be triggered during the creation of an Opportunity Product (Step added with Message set to "Create"). The other is configured to be triggered during the update of an Opportunity Product (Step added with Message set to "Update"). Both plugins write CRM data to an external SQL database (insert in one case, update in the other).</p> <p>The first plugin <strong>alone</strong> works great (Pre operation). It's only called during opportunity product creation and the data is successfully written to my external database.</p> <p>Once I activate the second plugin (Post operation + pre image), if I edit an opportunity product, it works great too. However, the plugins is also called when I create a new one... I really don't understand where this is coming from as I made sure of the following: - The two plugins are completely separated. I have two different assembly with a single step in each. - In each plugin, I have a condition checking the context.MessageName value (Create or Update) before the code is ran.</p> <p>Do you guys have an idea where this is coming from ?</p> <p>EDIT 1 (18/12/2013): I believe the Update plugin is called upon creation because of a "On Save" workflow that actually update some fields in the opportunity product. I am aiming toward using SharedVariables to prevent the execution of the Update plugin if the Create plugin is ran first. Here is the code used for sharing a variable between the two plugins. The SharedVariables.Contains check in the Update plugin is always false. To test this I create a brand new Opportunity Product while debugging the Update plugin.</p> <p>Create Plugin</p> <pre><code>Dim setFlag As Boolean = True context.SharedVariables.Add("NewSFR", setFlag) </code></pre> <p>Update Plugin</p> <pre><code>If context.SharedVariables.Contains("NewSFR") Then Dim receivedFlag As Boolean = context.SharedVariables("NewSFR") If receivedFlag Then Return End If End If </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload