locked
CRM 2011 - Territories and Members RRS feed

  • Question

  • Hi Guys,

    Need your help regarding below scenario.

    Scenario: We have 4 sales territories in our CRM 2011 on-premise installation. (North, East, West, South). Each Territory has it's own manager and sales people (System Users))as members. We also have territory lookup field on our Opportunity form which gets auto populated with the owner's(System User) territory when opportunity is created or re-assigned to someone else.

    Problem: When users are moved from one territory to another, Territory lookup field on the Opportunity form remains the same which gives false impression to sales manager about territory targets.

    I though I can fire a plugin on either user entity or territory entity when member is being moved but couldn't find the appropriate message for this operation.

    What are the other options I have to overcome this issue or any Plug in solution I might have missed.

    Thanks for reading.

    Regards,

    H.Desai

    Tuesday, May 19, 2015 10:41 PM

Answers

  • Hi,

         Create a plug-in on user entity. Message to use would be Update as change of Territory would fire update message for user entity. In this plug-in you should be able to fetch all the opportunity owned by this user. As over the time there could be many opportunities, validate the volume before doing this. If there are 1000s of opportunities you need to update, write an overnight batch program for this rather than plug-in. If it is 100s of them, write async plug-in to update the opportunities.

        If there are only few then write a sync plug-in.

    Hope this helps.
      
    -----------------------------------------------------------------------
    Minal Dahiya
    blog : http://minaldahiya.blogspot.com.au/

    If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

     

    • Marked as answer by H.Desai Thursday, May 21, 2015 11:34 PM
    Wednesday, May 20, 2015 7:23 AM

All replies

  • Hi,

    If i understand correctly, you want to change territory lookup field on Opportunity, when you changing a owner of a Territory entity. Then:

    You should fire a plugin: Pre-Territory-Update.

    In this plugin you should check, if field "user" changed. And if it is true, you should change Opportunity, as it needed.


    • Edited by xjomanx Wednesday, May 20, 2015 6:49 AM
    Wednesday, May 20, 2015 6:47 AM
  • Hi,

         Create a plug-in on user entity. Message to use would be Update as change of Territory would fire update message for user entity. In this plug-in you should be able to fetch all the opportunity owned by this user. As over the time there could be many opportunities, validate the volume before doing this. If there are 1000s of opportunities you need to update, write an overnight batch program for this rather than plug-in. If it is 100s of them, write async plug-in to update the opportunities.

        If there are only few then write a sync plug-in.

    Hope this helps.
      
    -----------------------------------------------------------------------
    Minal Dahiya
    blog : http://minaldahiya.blogspot.com.au/

    If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

     

    • Marked as answer by H.Desai Thursday, May 21, 2015 11:34 PM
    Wednesday, May 20, 2015 7:23 AM
  • Hi,

         Create a plug-in on user entity. Message to use would be Update as change of Territory would fire update message for user entity. In this plug-in you should be able to fetch all the opportunity owned by this user. As over the time there could be many opportunities, validate the volume before doing this. If there are 1000s of opportunities you need to update, write an overnight batch program for this rather than plug-in. If it is 100s of them, write async plug-in to update the opportunities.

        If there are only few then write a sync plug-in.

    Hope this helps.
      
    -----------------------------------------------------------------------
    Minal Dahiya
    blog : http://minaldahiya.blogspot.com.au/

    If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful"

     


    Why are you creating plugin on a user entity if user entity is not changing when you a choosing a user from lookup in a territory entity? What the purpose of it?

    • Edited by xjomanx Wednesday, May 20, 2015 7:40 AM
    Wednesday, May 20, 2015 7:39 AM
  • Hi,

        The plug-in will be needed on user entity as the user will change territory by changing the territory on the user entity. I am not sure what you are suggesting here.

    -Minal

    Wednesday, May 20, 2015 7:48 AM
  • Hi,

        The plug-in will be needed on user entity as the user will change territory by changing the territory on the user entity. I am not sure what you are suggesting here.

    -Minal

    As i understand, The territory entity has a link on a user entity, and user entity not contains a link on a territory.

    "Each Territory has it's own manager and sales people (System Users))as members"

    Correct me, if i wrong.

    So, user is not changing, when the Territory changing a manager.


    • Edited by xjomanx Wednesday, May 20, 2015 8:49 AM
    Wednesday, May 20, 2015 8:47 AM
  • Just another idea:  You could also do this with a Workflow process on the user entity.  Less code to write/debug.
    Wednesday, May 20, 2015 7:08 PM
  • Hi All,

    Thank you very much for your input and time taken to answer my question.

    @xjomanx : Yes, I want Territory lookup field on Opportunity to be updated when our manager changes the Territory of the user from Territory entity record.

    @Minal : Your solution will work if our manager is changing territory from user record but he goes into the Territory record and use 'Add Memember' functionality. This way he can move multiple users between territories. How do I capture this process in plugin? Which message fires when manager add member to territory within from the territory record ?

    @Chris : Using workflow, I am not able to find any event to fire this workflow. Also, I am not sure if I can capture values across 3 entities in workflow (User, Territory, Opportunity)

    My apologies to all for not being clear in my question about from where user are moved it to Territory. ( from Territory record instead of user record)

    Any thoughts ?

    Regards,

    H.Desai

    Thursday, May 21, 2015 5:14 AM
  • when a user moved from one territory to another fire your plugin and check the associated opportunities to user 

    if the user has opportunities then stop the action and raise an error message.

    for this you need trigger your plugin on pre-operation and stop the db action.


    ms crm

    Thursday, May 21, 2015 6:11 AM
  • Hi All,

    Thank you very much for your input and time taken to answer my question.

    @xjomanx : Yes, I want Territory lookup field on Opportunity to be updated when our manager changes the Territory of the user from Territory entity record.

    @Minal : Your solution will work if our manager is changing territory from user record but he goes into the Territory record and use 'Add Memember' functionality. This way he can move multiple users between territories. How do I capture this process in plugin? Which message fires when manager add member to territory within from the territory record ?

    @Chris : Using workflow, I am not able to find any event to fire this workflow. Also, I am not sure if I can capture values across 3 entities in workflow (User, Territory, Opportunity)

    My apologies to all for not being clear in my question about from where user are moved it to Territory. ( from Territory record instead of user record)

    Any thoughts ?

    Regards,

    H.Desai

    Hi, As a said in my first answer:

    You should fire a plugin: Pre-Territory-Update.

    In this plugin you should check, if field "user" changed. If it is true, you should change Opportunity, as it needed.

    Thursday, May 21, 2015 7:41 AM
  • Hi xjomanx,

    If you go into CRM -->Business-->Business Management -->Sales Territories --> and  Add member. Then you check the last modified date on that territory, it won't be the time you add the member. Meaning, adding member doesn't updates(modify) Territory record so plugin won't fire in this case.

    What I found by performing above step is, user record gets updated with new territory and last modified date gets changed to the time where member being added to the territory record.

    In this case, Minal's suggestion is correct. I just wasn't sure if changing user through territory record will fire plugin on User record.I should have read her answer more diligently :)..

    Thank you all for your time and suggestions. Appreciate your follow-ups.

    Regards,

    H.Desai



    • Edited by H.Desai Friday, May 22, 2015 12:17 AM
    Thursday, May 21, 2015 11:34 PM
  • Yes, but if you change a manager, it will be updated. I wrote, that you need to fire a plugin in a case, when you are changing a territory manager.
    Friday, May 22, 2015 6:26 AM
  • Please read my all the threads again. I never mentioned anything about changing Manager. It was all about changing Members of the Sales Territory !
    Sunday, May 24, 2015 9:24 PM