+ Start a Discussion
Vamsi DyanaVamsi Dyana 

Cannot perform insert operation:Apex Basics & Databases Writing SOSL Queries Prerequisite Code

Code under Prerequisite section of Writing SOSL Queries in Apex Basics and Databases 
User-added image

When tried this in Execute Anonymous Window as stated throws this error
User-added image
?
Best Answer chosen by Vamsi Dyana
@Karanraj@Karanraj
Looks like a duplicate alert error message which means there is already account record in your salesforce org with the same information.
Either try passing different account name and insert or check the duplication error records by following steps in the following link - https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Database_DuplicateError.htm

All Answers

@Karanraj@Karanraj
Looks like a duplicate alert error message which means there is already account record in your salesforce org with the same information.
Either try passing different account name and insert or check the duplication error records by following steps in the following link - https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Database_DuplicateError.htm
This was selected as the best answer
Mahesh DMahesh D
Hi Vamsi,

If possible, please paste your code, so that it will be easy to provide solution.

Use the above panel (< >) to paste the code.

Regards,
Mahesh
Mahesh DMahesh D
Hi Vamsi,

Please make sure that there are no existing records with the same name. If any then please delete them so that it will work properly.

Regards,
Mahesh
Vamsi DyanaVamsi Dyana
Thanx All