Workflow notifying a manager their employee was added to a group.

I have a workflow in activeroles 7.4, notifying a manager their employee was added to a group. Can someone please help me with the correct code in the email notification so it can not target the group but instead the user being added to the target group? 

I was using

<% =Operation.Target["samAccountName"] %> 

But this just says the group name and doesnt show the employee name.  I just need the manager to know the employee name in the notification email that was added to the target group.  thanks.

  • Yep - this is because the "Operation Target" in the case of your Workflow is indeed the group.  

    What you want in there is the "Operation Summary" - that will contain both the name of the user added and the group they were added to.

  • Thanks JohnnyQuest, I was hoping to just get the username and not the additional details, any idea if that is possible?  When I do operation summary it includes info that makes the email unclear.  thanks

  • I've seen something similar to this before, as Johnny mentions, when you add a user to a group, you're not actually modifying the user object, but the group object.

    Using a workflow, with a notification step similar to the below will enable you to target the manager(s) of those being added to a group, but one email will be sent to all managers, of all the users being added in a single request, IE:

     Mgr1 - Direct reports:

    • Emp1
    • Emp2 

    Mgr2 - Direct Reports:

    • Emp3
    • Emp4

    If Emp1, Emp2 and Emp3 are added to the same group, in a single request

    Mgr1 and Mgr2 will receive the same email, stating all the users added to the group in the request, IE

    Request to add Emp1; Emp2; Emp3 to SomeGroup successfully completed.
    
    Sumary: Add members to group
    Group: SomeGroup (Domain.com/Groups)
    Operation reason:
    Members to add: Emp1 (Domain.com/Users)
    Members to add: Emp2 (Domain.com/Users)
    Members to add: Emp3 (Domain.com/Users)

    So Mgr1 will see that Emp3 has been added, and Mgr2 will see Emp1 and Emp2 were added.

    If however you want to only send an email of the mgr's own direct reports only, you'll need to do this via script activity instead, and write a script to work out the adds and removes, and group the users by manager.

    From memory, a method I've used previously would be similar to the below:

    • Create a change workflow targeted against modification of the member attribute of a group (scope and who triggers the workflow is up to you)
    • Have a scripted step, which
      • Get the members currently in the group from the DirObject 
      • Get the member(s) being added or removed from the Request object
      • Work out which objects are being added, and which objects are being remove (I used dictionaries)
      • For any user objects being added, that has a manager set (grouped by manager), where the manager has an email address
        • Send an email to the manager containing all their direct reports being added
      • For any user objects being removed, that has a manager set (grouped by manager), where the manager has an email address
        • Send an email to the manager containing all their direct reports being removed
      • Where the group will no longer have any members
        • Send an email to the groups manager, advising the group in now empty.
  • I got what I needed from quest, below gave me the username and displayname of the user being added, thanks.

    <% =Workflow.SavedObjectProperties("Save object properties") .Property("samAccountName") %>

    <% =Operation.TargetToSet["member/PropertiesTable/displayName,samAccountName"] %>

  • This is interesting - you must have modified your workflow to make this work.