locked
Cascading data updates to other entities RRS feed

  • Question

  • Good afternoon,

     

    Not sure how to phrase this and been unable to Google up any results...

     

    How do you get CRM to cascade changes from one entity to another?

     

    For example, take the Territory entity which has a managerid on it.  Now I want to display that on the account entity, ideally storing the name of the manager on the account entity as a custom attribute.

     

    (I've managed that; via a plug-in, so using the account.territoryid attribute to look up territory, then onto users, and finally name!)

     

    All well and good; but what if someone edits the Territory?  In which case I need to update all account entities which use that Territory.

     

    How do I do that?  Is it possible via a workflow, or is this a plugin with some sort of query to return all accounts where territoryid is the one that's being updated?

     

    Thanks,

     

    Dr. Michael Dye.

    Wednesday, August 27, 2008 1:33 PM

Answers

  •  

    Another approach would be to add a new relationship between account (many) and a user (1) called Territory Manager (or whatever is appropriate). Add the new lookup field to the account form but have it disabled.

     

    Now you need to write a web services call in the account form OnLoad event that looks up the appropriate user for the account territory and populates the new lookup field. The hard part of course is the web services call - but there are posts on this elsewhere.

     

    Note that this does mean that the territory manager lookup on the account form only gets updated when someone opens the form but if you are writing queries then following the account - territory - managerid link will always get the current manager.

     

    Hope this all makes sense and is of some help.

     

    Thursday, August 28, 2008 7:14 AM
    Moderator

All replies

  •  

    Another approach would be to add a new relationship between account (many) and a user (1) called Territory Manager (or whatever is appropriate). Add the new lookup field to the account form but have it disabled.

     

    Now you need to write a web services call in the account form OnLoad event that looks up the appropriate user for the account territory and populates the new lookup field. The hard part of course is the web services call - but there are posts on this elsewhere.

     

    Note that this does mean that the territory manager lookup on the account form only gets updated when someone opens the form but if you are writing queries then following the account - territory - managerid link will always get the current manager.

     

    Hope this all makes sense and is of some help.

     

    Thursday, August 28, 2008 7:14 AM
    Moderator
  • Morning,

     

    Yes, I can see that approach too - so far I've kept away from web services and *loads* of Javascript - mainly 'cause it's a real pain to debug (whereas .NET I'm just more comfortable with!).

     

    The key difference is whether to use a lookup and relationship to the user entity on the account form, rather than just a disabled text field.  The original design just wanted to "show" the manager but if it's just a text field then it can't do emails etc. without first working out the GUID of the manager; ugly.

     

    I suppose I could combine my .NET updater with a lookup field on the account form and get the "best" of both worlds.

     

    Thanks though for the reply and I'm glad I didn't miss an obvious "GUI" click and set approach to this.

     

    Michael Dye.

    Thursday, August 28, 2008 7:49 AM