+ Start a Discussion
Dhilip DussaDhilip Dussa 

Need help on inserting record


I'm facing one issue while inserting a record.

I have once Multi-select picklist,
if select anyone i need to create one more record with the same name

the first time it is inserting fine,
but if try next time getting an error
Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Special Initiative: id value of incorrect type: a4D6C000000DMXJUA4

please help me,

List<Contact> mrl = new List<Contact>();

for(Integer i=0; i<wrapperList.size(); i++){
            Contact mr = new Contact();
            mr.name = wrapperList[i];
            mr.Account = wrapperList[i];
            mr.Opportunity__c = recordId;
            Insert mrl;

I'm inserting name with accountId only

Saravana Bharathi 1Saravana Bharathi 1
Hi Dhilip,

From the error message, i looks like its issue is not in contact insert, since id value of incorrect type: a4D..

Contact object prefix is 003. but it says a4D, it could be custom object.
In case, if there is any dependent logic or process builder or flow etc, which gets triggered because of inserting contact, could fail this.

Try the debug log and check it, if not you can post the debug log error message line here.

If it solves the problem, mark it as resolved.

AnudeepAnudeep (Salesforce Developers) 
If you are receiving the Salesforce Error "ID Value of Incorrect Type" this means that an ID being sent to Salesforce is not the correct type that Salesforce is expecting.

For example, some fields in Salesforce can only accept certain ID types (e.g., Contact ID, Account ID, etc.).  If you map a value for an ID of a different type, you will see this error.

Please check if the correct values are being passed in your code
mr.name = wrapperList[i];
mr.Account = wrapperList[i];
mr.Opportunity__c = recordId;

You can use Entity Key prefix decoder to look up the entity name

Salesforce Support
Petra janyPetra jany
Nice Post. Are you worried about a thesis writing service (https://www.globalassignmenthelp.com/ca/thesis-help) in Canada? We provide the best writing service at affordable prices. Order Now.