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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Lead Assignment though C# Plugin, while creating it.

(0) ShareShare
ReportReport
Posted on by 40

Hello All, 

I had written a plugin code to assign leads to different users based on some conditions.

Registed at

message: create

event: Post Operation

Code is working fine till 
=> service.Update(entity);

but it is not making me to save the record/failed to create record through import or any

and throwing an error like:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Generic SQL error.Detail:
<OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts">
<ActivityId>d2d4310b-a254-4a90-a74c-efb68c00b40d</ActivityId>
<ErrorCode>-2147204784</ErrorCode>

please help me to solve this asap.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Try pre-event and just put new owner to ownerid field without update.

  • Suggested answer
    ARIFNIIT Profile Picture
    1,391 on at

    Resister Plugin on Pre-Operation and change owner filed value based on condition. no need to update it.

  • Herald Jeramiah Profile Picture
    35 on at

    Hi, You can progress in two ways

    1)Please Make sure any other plugin triggering on update of that entity. If so check Plugin Trace Log whether that plugin fails on update of that entity.

    There is no proper message on exception which you given, Maybe some other plugin may fail on the same pipeline.

    2)Instead of using post operation you can go through pre-event as Andrew Butenko suggested.

    Hope it helpful

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans