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
Sayeeda Banu 5Sayeeda Banu 5 

How to create User Territory Records in test class

Hello All,

I know that DML operations are not allowed on User Territory , But i need to create a test data for  UserTerritory,

Please help me to create Test data for User territory.
PawanKumarPawanKumar
Please try below link.

https://success.salesforce.com/answers?id=90630000000h92hAAA

Regards,
Pawan Kumar
Sayeeda Banu 5Sayeeda Banu 5
what is   Target__c target = new Target__c(MedRep__c=UserId.Id);
        insert target;
       ,

ineed only three things insert user, insert territory and insert User Territory
Please help me am new to SF

 
PawanKumarPawanKumar
this is just a sample custom object. You can ignore this.