You need to sign in to do that
Don't have an account?
SeAlVa
The point is,
1) why it says that "invalid record id: []" if it says the error before.
2) an upsert call without specifying a field, should take the ID field to know if its an insert or upsert call. if has no ID, why it does not make an Insert?
Kind regards
Upsert failed. First exception on row X with id a0XD00... ; first error: INVALID_ID_FIELD, invalid record id: []
Hi everyone,
I'm having the following Error
Upsert failed. First exception on row X with id a0XD00... ; first error: INVALID_ID_FIELD, invalid record id: []
The line that causes the error is
upsert aNewMap.values();aNewMap is a Map which values are records that might or might not have ID.
The point is,
1) why it says that "invalid record id: []" if it says the error before.
2) an upsert call without specifying a field, should take the ID field to know if its an insert or upsert call. if has no ID, why it does not make an Insert?
Kind regards
The id which is present in your sobject is of different type.
For example,
Suppose Sobject is of Account and you are using Contact's Id in Id field of account which will cause exception.
Please check if this is the case.
Post the code and the issue again and we can take a look ...
Map<String, myQueue__c> aNewMap = new Map<String, myQueue__c>();
to
Map<Id, myQueue__c> aNewMap = new Map<Id, myQueue__c>();
and similarily
from
Map<String, myQueue__c> anOldMap = new Map<String, myQueue__c>();
to
Map<Id, myQueue__c> anOldMap = new Map<Id, myQueue__c>();
and then test it
@Vinit_Kumar, we are storing the 18 characters ID, is there any issue with it?. I agree with you, it is better to use ID fields whenever possible, but as it was another developer who implement it and it has been working fine for the last 2 years, so I did not wanted to change it).