You need to sign in to do that
Don't have an account?
Abhishek Pal 33
DML operation in User Territory Object?
How to use DML operation in User Territory Object in salesforce. I searched on Google and they said use salesforce SOAP API to resolve this. Does anyone has some example I didnt have much idea about it?
Thanks in advance.
-Abhishek
Thanks in advance.
-Abhishek
I guess this is what you are looking for :
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/Territory2.htm
If not, can you let me know the requirement, as to what you are trying to do on user territory object?
Code:-
UserTerritory userTerritory= new UserTerritory();
User userId=[Select Id from user where Alias=:test.Alias];
Territory terrId=[Select Id from Territory where Name=:fieldValues[4]];
userTerritory.UserId= userId.Id;
userTerritory.TerritoryId=terrId.Id;
insert userTerritory; (Error DML operation not allowed on user territory object)
Above code is not working. Apart from API if there is some other option from where I can insert userTerritory object please let me know.
I am checking in Setup-->ManageTerritories---->Settings-->
https://help.salesforce.com/apex/HTViewHelpDoc?id=tm2_enable_tm2.htm&language=en_US
The settings that you have mentioned above is enabled for my org. If I go in Setup---->Territories--->
I cant find any option Enable Enterprise Territory Management. Please see the below screenshot for the same.
I have achieved it after many researches. here you go: