Assigning a Task created within a Workflow to a User based on Connection Role from related Account

إجابة مقترحة Assigning a Task created within a Workflow to a User based on Connection Role from related Account

  • Friday, May 11, 2012 6:50 PM
     
     

    I'm not really looking for a specific "how-to" (although certainly wouldn't complain), but rather some guidence as to how this type of situation should be addressed. I believe the core issue here is "how do I find a User based on a specific Connection Role on a related Account from within a Workflow". However, as I look through the available dynamic values available in the Workflow, I do not see Connections (or connection roles) as a related entity, nor do I know how I would "match" it to a specific role type if it was available.

    Perhaps a totally different approach is needed to pull this type of infomration (plug-ins, custom workflow activities, etc), and I am perfectly fine with that.  I'm just a little overwhelmed and trying to figure out right path to take. I've being working with C#/WinForms/WebForms/etc for many years, but am completely new to dealing with Dynamics CRM.


    Details on what I need to pull off:

    Background: Each of our Clients are setup as Accounts in the system. For each of these Accounts, there are multiple employees (Users) assigned to these accounts via Connection Roles.

    Setup: Client XYZ has 4 of our users assigned to it via connection roles. These roles are Lackey (Person A), Presenter (Person B), Overlord (Person C), and Assistant (Person D).

    The Overlord has just returned from a meeting with Client XYZ and has determined that we need to "Report on Stuff", and has told their Assistant to get the ball rolling. Our company has to "Report on Stuff" all the time, so hopefully the creation of the following items can be automatted via a workflow initiated at the account level by the assistant

    Case -
           Name: Report On Stuff for Client XYZ
           Owner: User setup as Overlord for Client XYZ
    Task - Create Report on Stuff for Client XYZ
           Related to Case "Report On Stuff for Client XYZ"
           Owner: User setup as "Lacky" on Client XYZ
     Task - Review Report on Stuff for Client XYZ
           Related to primary case
           Owner: User setup as Overlord for Client XYZ
     Appointment - Present Report on Stuff for Client XYZ
           Related to primary case
           Required: Users setup as Presenter and Overlord.

    Any help or guidance you could give would be appreciated.

All Replies

  • Friday, May 11, 2012 7:32 PM
     
     Proposed Answer

    For this scenario, you won't be able to do it using the out-of-the box workflow UI. You will need to develop a generic custom workflow activity that returns a User record based on the Connection Role and the related Record Id.

    You can then use the returning result of this custom workflow activity to create your case, tasks and appointment.

    For code reference on how to query the Connection entity, please refer to http://msdn.microsoft.com/en-us/library/gg509049.aspx

    Hope this helps.


    Dimaz Pramudya - CRM Developer - CSG (Melbourne) www.xrmbits.com http://twitter.com/xrmbits

  • Friday, May 11, 2012 9:03 PM
     
     

    Hi,

    I'm not sure custom workflow activities will help here. It probably depends on whether you can have multiple users linked to the same account via the same connection role. In other words, is it possible that for Client XYZ there will be two Overlords(and, so, both of them will have to be added to the case/task/appointment)?

    If yes, then your workflow activity will have to return a list of users, and your workflow will have to work with that list..and I'm not sure it's possible(I believe it's not). 

    You could use a plugin instead. Since you would need to start that plugin from the workflow, you may need some dummy entity (that would have a reference to the account. Create an entity in your workflow, set a reference, and have a plugin start on new record for that entity. One the plugin is finished, delete the entity right from the plugin)

    On the other hand, if the relationships are always 1 to 0/1 (for every role, no more than one user can be associated with an account), then you might want to switch to lookups instead of connections. You will have no problems with lookups in the workflows.


    Alex Shlega, GotchaHunter.Net


    • Edited by Alex Shlega Friday, May 11, 2012 9:04 PM
    •  
  • Friday, May 11, 2012 9:35 PM
     
     

    Yep. If you have multiple users that act as the Overlord for a given Account, you would have to do it in slightly different way.

    Alex, creating a dummy entity just to achieve this seems to be a bit overkill. You can always put the whole logic for this in a custom workflow activity.


    Dimaz Pramudya - CRM Developer - CSG (Melbourne) www.xrmbits.com http://twitter.com/xrmbits

  • Friday, May 11, 2012 9:42 PM
     
     

    >Alex, creating a dummy entity just to achieve this seems to be a bit overkill.

    Agreed:) Custom activity might be the way to go, though most of the logic should be in there (without passing data from that activity back to the workflow). Unless it is CRM online.


    Alex Shlega, GotchaHunter.Net


    • Edited by Alex Shlega Friday, May 11, 2012 9:43 PM
    •  
  • Friday, May 11, 2012 9:45 PM
     
     

    The latest Update Rollup 9 Beta contains full support for Custom Workflow Activity on CRM Online. :)

    I was so happy when I saw that line in the Product Release Note. Now we just have to wait til the RTM version comes out and applied to CRM Online.


    Dimaz Pramudya - CRM Developer - CSG (Melbourne) www.xrmbits.com http://twitter.com/xrmbits

  • Friday, May 11, 2012 9:47 PM
     
     
    Good stuff. They've been promising it in Q2 for quite some time. Waiting.. 

    Alex Shlega, GotchaHunter.Net