Tag: TerritoryManagement

Manage UserTerritory table through REST API

UserTerritory is one of the few objects that don’t allow DML Operations. However, we can manage it through the REST API. We could assign a User to a Territory by using the following APEX code: HttpRequest req = new HttpRequest(); Http http = new Http(); String baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); req.setEndpoint( baseUrl + ‘/services/data/v34.0/sobjects/UserTerritory/’); req.setHeader(‘Authorization’, ‘OAuth […]