Print this page

Getting the error: "duplicate value found duplicates value on record with id: " when importing Quotas (Customizable Forecasting)

Knowledge Article Number 000003076

When a user attempts to Import Quotas (RevenueForecast object available when using Customizable Forecasting) via the API using the Apex Data Loader, some of the updates work properly but other's error out with a message "duplicate value found: <unknown> duplicates value on record with id: <unknown>."  In some circumstances the insert/update/upsert appears to work properly. However when the User record detail page is viewed, the corresponding Quota values are not visible. 

Resolution In order to update Quota information you will need to have the Revenue Forecast ID. However RevenueForecast records are not created by default when Customizable forecasting has been enabled. They are created when you edit and save a quota value for a specific period.

If Quota values have been edited or populated for Users/Periods when an Upsert/Insert operation is performed on the RevenueForecast table, the Quota's that previously existed will error out.  

In order to update the Quota values for RevenueForecast records that currently exist, the user will need to add the RevenueForecast Id to the records which threw the error and then run an additional update operation.

In some circumstances it may be easier to start with a new Update file that already contains the Revenue Forecast Id's and populate the Quota information accordingly.

We can ensure that Revenue Forecast records exist for every period/user by creating a csv file which contains User Id, the Start Date for each period, and the Quota value for that given period.  

Note:  If you are utilizing Multiple Currencies you may need to specify the CurrencyISOCode column and populate it with the corresponding currency for the Quota values.  If CurrencyISOCode is not specified the currency will be imported as the organizations standard currency.

Using this file run an insert operation on the Revenue Forecast table mapping the User Id, Quota, and Start Date columns in your file to the associated Salesforce fields.  

During this operation you may receive errors such as  "duplicate value found: <unknown> duplicates value on record with id: <unknown>" . This means that Revenue Forecast records for those given User ID and Period combinations already exist in Salesforce.  You can ignore these errors.  The remaining insert operations should be a success with a message that reads "Item Created" which indicates that Revenue Forecast records for those User Id and Period combinations have been created in Salesforce.

Now you should be able to run an export on the RevenueForecast table, which will include all of the User Id and Period combinations with their respective RevenueForecast ID's (which will show as Id on the table).  

Note:  The export results will only include previously created records and those which were created via the insert operation above.  It is also recommended that you include the Startdate field for easier reference when working with the file.  Optionally, you can also run an export on the User table including User Id's and Names.  You can then use this file to populate a name column in your RevenueForecast Export File using Excel's Vlookup functionality this will allow you to reference name's rather than User Id's when working with the file.

Finally, use this file as the basis for populating the corresponding user's Quota amounts for the given periods.  Using the updated file run an Update operation on the RevenueForecast table mapping Revenue Forecast ID to the Id column and Quota to Quota column in your export file. Note: You made need to map your CurrrencyISOcode column if you use multiple currencies.  This will allow you to wholly populate all Quota amounts for affected users.

promote demote