0

I'm trying to insert some UserTeamMembers in an Apex test class but i'm getting the "DML operation Insert not allowed on UserTeamMember" error.

Looking at the documentation (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dml_non_dml_objects.htm) there is no mention of this object not supporting DML operations.

I've tried wrapping it in a System.runAs() method but the error still occurs. Has anyone else cam across this error or found a workaround?

2

Just because the SOAP API supports X operation on Y object, does not mean that Apex Code does. There are certain limitations in place in Apex Code in regards to DML operations that could be very expensive. For now, you'll need to use a real user. You can query users and userteammember records without using SeeAllData=true, so you can still work in isolation mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.