function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dan JonesDan 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:
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!
Best Answer chosen by Dan Jones
KevinPKevinP
This may be a documentation error. I can't get an upsert on additional number to work either.

All Answers

KevinPKevinP
This may be a documentation error. I can't get an upsert on additional number to work either.
This was selected as the best answer
Dan JonesDan Jones
Just an update in case anyone else comes across this problem,

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!