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,...
Unanswered

can not insert duplicate key error while creating service task in MS Dynamics 365 version 1612 (9.0.12.4)

(0) ShareShare
ReportReport
Posted on by 10

Dear Support Team,

I got a below error while creating service task in Dynamics 365

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Cannot insert duplicate key.Detail:
<OrganizationServiceFault xmlns:i="">www.w3.org/.../XMLSchema-instance" xmlns="">schemas.microsoft.com/.../Contracts">
<ActivityId>2d2084ee-44c7-49cb-86c4-a23cd9fe8d53</ActivityId>
<ErrorCode>-2147220891</ErrorCode>
<ErrorDetails xmlns:d2p1="">schemas.datacontract.org/.../System.Collections.Generic">
<KeyValuePairOfstringanyType>
<d2p1:key>OperationStatus</d2p1:key>
<d2p1:value xmlns:d4p1="">www.w3.org/.../XMLSchema" i:type="d4p1:string">0</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>SubErrorCode</d2p1:key>
<d2p1:value xmlns:d4p1="">www.w3.org/.../XMLSchema" i:type="d4p1:string">-2146233088</d2p1:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>Cannot insert duplicate key.</Message>
<Timestamp>2020-02-21T03:42:43.5271868Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText>

[Infoman.Crm.ServiceTaskPlugins: Infoman.Crm.ServiceTaskPlugins.PartRequirements.RelationGeneratorPlugin]
[c6f984f0-c11a-e311-9008-00155d204602: Infoman.Crm.ServiceTaskPlugins.PartRequirements.RelationGeneratorPlugin: Create of cu_servicetask]


</TraceText>

Any one help me and provide solution for this?

Best Regards,

Punit

I have the same question (0)
  • mobeenmohsin Profile Picture
    on at

    Hi Punit,

    There are couple of reasons for this exception and this exception is getting generated from customer plugin, please help to review your plugin login or you can un-register that plugin step  and create entity record. Please also help to confirm if you entity has auto number or not.

    if your entity has auto number then you can check the seed value and the following document may help you:

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/create-auto-number-attributes

    if your entity don't have auto number you can verify if your entity has keys using Setting > Customize the system, under each entity we have keys option where we can define unique keys. Thank you.

    Based on exception, it seems your plugin logic is creating problem while creating record. Please review the plugin logic and try above two options for auto number and unique keys for entity.

    Best Regards,

    Mobeen Mohsin

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
ManoVerse Profile Picture

ManoVerse 131 Super User 2026 Season 1

#3
Nagaraju_Matta Profile Picture

Nagaraju_Matta 128

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans