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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Changing the ownership in preoperation Create plugin to a Team

(0) ShareShare
ReportReport
Posted on by 30

Hi

I have a  requirement to change the ownership of the record before it gets created. Need to set the owner as  a team. I can't opt for post operation as I have workflow to create work orders which are triggered on the record creation and inherits same owner. I am trying with below code but , it is giving invalid argument exception.

I am fetching OwnerTeam details from another entity

targetEntity["ownerid"] = new EntityReference("team", OwnerTeam.Id);// this does not work

// tried below as well 

EntityReference owner = new EntityReference();

owner.Id = ((EntityReference)(OwnerTeam)).Id;
owner.LogicalName = ((EntityReference)(Owner)).LogicalName;
targetEntity["ownerid"] = owner;

As its preopertaion , I ma not calling create method again. I am able to change any other field like Name in this except the Owner.

pastedimage1577171607398v1.png

Kindly note : I can do this manually on the form, it working fine, hence do not think its  security issue. The team selected is of type Owner

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Register your step on pre validation.

    This stage occurs before any security checks are preformed to verify that the calling or logged-on user has the correct permission to perform the intended operation.

  • Vrushali R Profile Picture
    30 on at

    Hey thank you so much. It worked so smoothly on Prevalidation.

  • Community Member Profile Picture
    on at

    This works but doesn't make any sense.  There is no security issue.  What is the difference between a change in the context in stage 20 vs stage 10?  Aren't both before the operation?

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Hamza H Profile Picture

Hamza H 142 Super User 2026 Season 1

#2
Nagaraju_Matta Profile Picture

Nagaraju_Matta 128

#3
11manish Profile Picture

11manish 99

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans