You need to sign in to do that
Don't have an account?
Dan Jones
DML not allowed on AdditionalNumber
Hello,
I'm trying to perform a simple Upsert operation with a trigger on the AdditionalNumber object (related to the Call Center stuff).
However, I'm getting the error message:
DML not allowed on AdditionalNumber
I've checked the objects documentation available here:
https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_additionalnumber.htm
It seems it does support an upsert call.
My code is below:
Where am I going wrong here?
Many thanks!
I'm trying to perform a simple Upsert operation with a trigger on the AdditionalNumber object (related to the Call Center stuff).
However, I'm getting the error message:
DML not allowed on AdditionalNumber
I've checked the objects documentation available here:
https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_additionalnumber.htm
It seems it does support an upsert call.
My code is below:
trigger UpdateCallCenter on User (after insert, after update, before delete) { if (Trigger.isAfter) { if (Trigger.isInsert || Trigger.isUpdate) { AdditionalNumber[] insertNumber = new List<AdditionalNumber>(); for (User u : Trigger.new) { AdditionalNumber aN = new AdditionalNumber(Name = u.Name, Phone = u.Extension, CallCenterId = u.CallCenterId); insertNumber.add(aN); } upsert insertNumber; } } }
Where am I going wrong here?
Many thanks!
All Answers
As KevinP said it was indeed a documentation error following contacting Salesforce support. They told me they'd escalate this and amend the documentation.
Many thanks!