function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sushmaraosushmarao 

System.DmlException: Insert failed. DUPLICATE_VALUE, duplicate value found: on record with id..

I have an object Job on which I have a trigger which has the code for the generation of the auto number according to the job number of the last created job. (increment value of the job number of the last created job). I am querying the last created job as follows:

[Select Id, Name,Job_Auto_Number__c,Job_Id__c from Job__c ORDER BY Created Date DESC LIMIT 1];

 

I have a VF page on which I am inserting 5 jobs in a list. Some times I am able to insert 5 jobs while some times I get the error 'System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: unknown duplicates value on record with id' .

 

What can be the reason for this error, If it is the same date and time why does it work some times?

How can I overcome this situation? What else can I use instead of created date?

 

Please help,

Thanks in advance.

Murthy vvrMurthy vvr

Did get Solution to DUPLICATE_VALUE error ???

 

Thanks,

Murthy VVR