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
m 10m 10 

Apex trigger AvoidDuplicate caused an unexpected exception, contact your administrator: AvoidDuplicate: execution of BeforeInsert caused by: System.SObjectException: SObject row wa

hi team ,
Below error message when i am deplpoyiong total copy from my system .
Error: Invalid Data.  Review all error messages below to correct your data. Apex trigger AvoidDuplicate caused an unexpected exception, contact your administrator: AvoidDuplicate: execution of BeforeInsert caused by: System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Contact.Phone: Trigger.AvoidDuplicate: line 27, column 1
Swaminathan BalasubramanianSwaminathan Balasubramanian
hi imran,
Check Your SOQL Query Selected Column 'Contact.phone' included or not
Manas Kanti DattaManas Kanti Datta
Hello Imran,
can you post your code? 
Thanks,
Ajay K DubediAjay K Dubedi
Hi Imran,

The error means you're trying to access something that you didn't include in the query, in this case, you reference Phone field without query it from Contact Record.you need to either remove the reference of Contact. Phone, or update your query to include that Contact.Phone.


I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks,
Ajay Dubedi