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

Notifications

Announcements

No record found.

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)
  • Suggested answer
    DhananjaySharma Profile Picture
    65 on at

    Hi Felipe,

    Could you please share the error log details.

    As per my understanding your first plugin (Pre validation) not assigning the role to Team.

    Thanks,

    Dhananjay

  • Feminho Diniz Profile Picture
    67 on at

    The first plugin does not assign, just create the Team.

    the error comes on the 3th one:

    Errore nell'esecuzione del Processo: Principal team (Id=fda1b7dd-0dcb-e911-a84a-000d3ab2d24c, type=9, teamType=0, privilegeCount=0, is missing prvReadAccount privilege (Id=886b280c-6396-4d56-a0a3-2c1b0a50ceb0) on OTC=1071. context.Caller=64209a47-b968-e811-a95c-000d3ab680fa

    I know, it's saying that the team does not have privileges (even if it has... I printed all security role that the team to be assign had and one of those roles have the right privilege).

    The thing is that when I go to look for the team (in this case, the one with if fda1b7dd-0dcb-e911-a84a-000d3ab2d24c) it's not saved on the system. How? if the creation was done in pre-validation step?

  • Suggested answer
    Kokulan Profile Picture
    18,054 on at

    Hi

    Yes you are right, any change made in Pre-Validation should be persisted.

    Could you check if the team and security roles are there? it could be that its not rolling back whats done in Pre-Validation but the records are simply not available for Pre-Creation or Post-Creation stages.

  • Feminho Diniz Profile Picture
    67 on at

    Hi Kokulan.

    Yes, I'm sure that the record was created.

    On pre validation i have:

    Guid teamId = service.Create(team);

    targetEntity["ftpsiteurl"] = teamId.ToString();

    On pre-creation:

     context.SharedVariables.Add("teamId", targetEntity.GetAttributeValue<string>("ftpsiteurl"));

    On post create
                        string teamId = (string)context.SharedVariables["teamId"];
                        tracingService.Trace("TeamId: " + teamId);


                        AssignRequest assign = new AssignRequest
                        {
                            Assignee = new EntityReference("team", new Guid(teamId)),
                            Target = targetEntity.ToEntityReference()
                        };

    And i have this on my log: TeamId: 567da305-14cb-e911-a849-000d3ab2d007 (the id of the created team that i can't find because it is roolbacking )


    I even printed the security roles and got the Guid of the ones I setted up for this team on my code

  • Guido Preite Profile Picture
    54,086 Moderator on at

    why you need 3 plugins? 1 plugin in post-op is not enough for your logic?

  • Feminho Diniz Profile Picture
    67 on at

    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?"

  • rthompson Profile Picture
    1,532 on at

    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

  • DhananjaySharma Profile Picture
    65 on at

    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.

  • Feminho Diniz Profile Picture
    67 on at

    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

  • Feminho Diniz Profile Picture
    67 on at

    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?

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans