web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Why is my Plugin Pre-validation roll-backing?

(0) ShareShare
ReportReport
Posted on by 67

Hi.

I have 3 Sync Plugins running at Account.

1º Plugin: Pre-Validation that creates a Team and give it Security Roles.

2º Plugin: Pre-Creation that simply pass the id of that team to a shared variable and clean some field

3º Plugin: Post-Creation that assign the team to the created account.

At the the 3th plugin it is crashing, saying that the team do not have privileges of read account (the one I inserted on the first plugin). I printed all privileges of that team before the assign and they are there.

The question here is not why it's crashing but that when it crashes its always roll-backing all 3 plugins.

Ok, It's expect a rollback on Pre and Post create but the Pre-Validation one runs out of database transaction, right?

Thank you all.

*This post is locked for comments

I have the same question (0)
  • Feminho Diniz Profile Picture
    67 on at
    RE: Why is my Plugin Pre-validation roll-backing?

    Hi Muhammad.

    I really don't know why it was rolling back. Honestly, it's still a mystery to me. I don't know why it was solved by changing the steps of the execution of the plugin but it worked... maybe the team was created but not associated with any record at the end? really don't know. Still, it was the only strange case I had with plugin steps in 8 years of Dynamics CRM. Usually, it runs like that:

    1) Pre-Validation plugins are out of any transaction so they will never roll back the operation. For example, if you create an Account and a Pre-Validations plugin goes on error, the Account will still be there

    2) Any error in any Sync plugin on Pre or Post Update will rollback the entire chain as they are part of the same transaction

    3) Async plugins that go on error will also rollback but they have individual transactions so it will be rolled back without affecting other plugins (community.dynamics.com/.../657077)

  • Siddique mahsud Profile Picture
    11 on at
    RE: Why is my Plugin Pre-validation roll-backing?

    Hi,

    Im also looking for clarificaiton on this, in my below post:

    community.dynamics.com/.../effect-of-errors-in-pre-execution-post-stage-on-updates-made-in-pre-validation-stage-in-dynamics-crm-plugins

    Thanks

  • erhan.keskin Profile Picture
    2,253 on at
    RE: Why is my Plugin Pre-validation roll-backing?

    When you are creating the team, are you using the plugin context or creating another service?

    Have you checked if it shows that is in transaction? (IPluginExecutionContext.IsInTransaction = true/false)

  • Feminho Diniz Profile Picture
    67 on at
    RE: Why is my Plugin Pre-validation roll-backing?

    Hi Erhan.

    as I said, the permission problem was resolved and now everything is working. I didn't change the code, just move the pre-validation one in post-operation and the assign in a workflow. It means that the problem was the "when" each code was executed.

    Now I don't have a pre-validation plugin anymore but I just don't get why was rolling back.

    I'm sure that the team was created because I logged the created team id on my account pre-validation plugin. It just don't make sense to me that my account post-operation was rolling back a creation of team that i make on a account pre-validation plugin

  • erhan.keskin Profile Picture
    2,253 on at
    RE: Why is my Plugin Pre-validation roll-backing?

    Hi,

    As opposed to questioning why it is rolling back, i think the question is why it doesn't succeed as you say the security role has all the privileges. I just wonder if that security role is also at the team's business unit level. What i mean is that the security role is at sub business unit level or main business unit level!

    For the rollback part;

    This guy tells "If you are creating a record, as the record is not created at this point, you will not have a record GUID.", it sounds like create event is being rolled back when an error occurs in Pre or Post events. What do you think?

    [View:https://carldesouza.com/dynamics-365-pre-validation-plugin/:750:50]

    Regards,

  • Feminho Diniz Profile Picture
    67 on at
    RE: Why is my Plugin Pre-validation roll-backing?

    Just to let you know: I fix the error putting the creation of the team (with the security roles connection) all in the plugin post-operation and then the assign of the created account to the team in a CWA. It's working. I guess that doing that the open threads I had that were passing the accounts permissions to the related ones (such as customeraddress as i said before) are finishing before to execute the CWA.

    The mystery remains: WHY WAS MY PRE VALIDATION PLUGIN ROLL-BACKING?

  • Feminho Diniz Profile Picture
    67 on at
    RE: Why is my Plugin Pre-validation roll-backing?

    Hi!

    So, as i said before, I logged and the team is been created with the security roles but "the propagation of those privileges for other related entities such as CustomerAddress (OTC=1071) seems to be done async".

    That's why I'm getting this error. That still do not explain why is my plugin rollbacking

  • DhananjaySharma Profile Picture
    65 on at
    RE: Why is my Plugin Pre-validation roll-backing?

    Hi Felipe

    Throw UI also if you doing same thing then you will get the error while assigning newly team to account.

    because team should have an security role.

    You can do some below work around.

    1. please insert the Trace log into plugin and check if team created successfully.

    2. Try to assign the security role to that newly created team and check in trace log that role successfully assigned to team.

    3. Also check the user who assigning the role to team must have append & append to privilege.

  • rthompson Profile Picture
    1,532 on at
    RE: Why is my Plugin Pre-validation roll-backing?

    Something times sending screenshot on something like this can be very helpful.

    Can you send a screenshot of the entity privileges based on pre-validation

  • Feminho Diniz Profile Picture
    67 on at
    RE: Why is my Plugin Pre-validation roll-backing?

    Because the association of the rules is sync but the propagation of those privileges for other related entities such as CustomerAddress (OTC=1071) seems to be done async, that's why we did that out of transaction on pre validation.

    My question remains: "why is rollbacking the created team?"

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans