0

I have a user associated with a territory who has left organisation.

Now I wish to remove the mapping association for this user.

Removing this user from Territory assigned users page does not solve my purpose. But when checked from workbench, the association still exists.

As per the document:

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_userterritory.htm

I need to use a getDeleted() call to delete a user from a territory (not simply removed from the territory)

Can you please assist a sample code for this.

Thanks!

  • There are two flavors of Territory Management - Territory Management and Enterprise Territory Management. The objects involved are different. The latter allows deletion of UserTerritory2Association; the getDeleted call on the former only tells you if the object was deleted, not actual deletion – cropredy Feb 21 '17 at 5:04
  • As per document : developer.salesforce.com/docs/atlas.en-us.api.meta/api/… Users who are inactive in a territory are not explicitly assigned to the territory, but own an open or closed opportunity that is associated with the territory. For example, a user may have been transferred out of a territory, but still own opportunities in his or her old territory. Until a user is deleted from a territory (not simply removed from the territory), the record is not returned in a getDeleted() call. Please assist how I can delete the user from territory. – Salesforce Developer Feb 21 '17 at 8:08
  • which flavor of territory management are you using? – cropredy Feb 21 '17 at 14:24
0

Well I really doubt on what you are saying:

I need to use a getDeleted() call to delete a user from a territory (not simply removed from the territory)

Salesforce provide you Territory Management 2.0, which can easily help you with user associations and removal. this is one of the feature which released in Winter 15, see Release note : https://success.salesforce.com/ideaView?id=08730000000BpaLAAS

If you Org is created before Winter 15 release in that case you can contact to Salesforce to enable that feature for you. See more information on Territory Management: http://releasenotes.docs.salesforce.com/en-us/winter15/release-notes/rn_sales_territory_management_2_dot_0.htm

You can also look into following thread if it can help you: https://success.salesforce.com/answers?id=90630000000gpTYAAY

let me know if noting work for you.

  • As per document : developer.salesforce.com/docs/atlas.en-us.api.meta/api/… Users who are inactive in a territory are not explicitly assigned to the territory, but own an open or closed opportunity that is associated with the territory. For example, a user may have been transferred out of a territory, but still own opportunities in his or her old territory. Until a user is deleted from a territory (not simply removed from the territory), the record is not returned in a getDeleted() call. Please assist how I can delete the user from territory. – Salesforce Developer Feb 21 '17 at 8:07

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.