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 :
Customer experience | Sales, Customer Insights,...
Unanswered

Updating An Entity From Plugin Trips Workflow

(0) ShareShare
ReportReport
Posted on by
I have a plugin that is sending some Opportunity data to another system of ours when certain fields in the opportunity are updated and then I save the id of this new record from this other system back into the opportunity.  We have a workflow that runs when the status changes, it checks a few fields to verify they meet our requirements and if not, prevent the opp from going to the next sales stage.  Sometimes, not always, this workflow is tripped when I do an update on the opp even though the only thing I've changed is adding this id to this opportunity.  The sales stage never changes.  These required fields are missing but since the sales stage never changes and technically, we don't require these fields until the user tries to move it to the next sales stage, this should pass this workflow.  I've registered this plugin the /Post Operation/ pipeline stage because I want to make sure the opportunity is saved before this plug in runs.  Is there something I can do so that my plugin bypasses this validation?  Is there a better way I should be handling this scenario?  Is there something I need to check with our required field validation when sales stage changes?   I don't want to block the user form saving the opportunity, just want to be able to process some of the data after it's saved.  Below is an example of my code.
 
 IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
_service = factory.CreateOrganizationService(context.UserId);
 
if (context.InputParameters != null)
{
      Entity entity = (Entity)context.InputParameters[/Target/];
      Entity opp = (Entity)_service.Retrieve(/opportunity/, entity.Id, new ColumnSet(true));
 
    <Save some of the opp data to this other system and get back the id>
 
    opp.Attributes[/my_system_id/] = item.id;
   _service.Update(opp);
}
 
I have the same question (0)

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans