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
kmorf_entransformkmorf_entransform 

Error while deploying to production

Hi im trying to deploy some controllers to production but im getting this error that says "System.DmlException: Insert Failed. First Exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CopyAsset: execution AfterInsert". Im thinking its because i have a query statement inside a loop of the trigger CopyAsset. I took the query statement outside the loop and tryied to deploy CopyAsset to production but im still getting that error

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

Probably not the case. It may be that you're trying to edit a locked row (a record that's already committed for this transaction), or you're recursively calling your code, or some other already-existing code in production is reacting to your code and failing. I can't be of much more help, because there's no code to look at. Try looking at the debug logs, and it should make more sense.

All Answers

sfdcfoxsfdcfox

Probably not the case. It may be that you're trying to edit a locked row (a record that's already committed for this transaction), or you're recursively calling your code, or some other already-existing code in production is reacting to your code and failing. I can't be of much more help, because there's no code to look at. Try looking at the debug logs, and it should make more sense.

This was selected as the best answer
steve456steve456

When you get an error as cannot update create activity make sure you check for the field level security of the fields in production and  also make sure you give the test insert fields properly.

kmorf_entransformkmorf_entransform

thanks. After i got the validation errors i clicked on view logs and that actually told me what the problem was. It turned out that i was missing some fields when trying to insert the record.