I have a custom object MyCustomObj__c which has a field called "ContactData".
I am trying to insert a record into the custom object with the following apex method. It gives an error:
Invalid ID
The value Hari already exists in the Contact list.
apex code:
public static String saveData(){
MyCustomObj__c newObj = new MyCustomObj__c();
newObj.contactData__c = 'Hari';
insert newObj;
return "success";
}
How do I insert a row?