Workflow SavedObjectProperties for multiple results (users)

Hi, 

I have a scheduled workflow that filters users based on a VA and then searches for users with this VA in a specific OU and then runs some PowerShell scripts for various things. 

I've used both of the commands below but neither seems to work, so i guess my question is how do I refer to "workflow Saved object properties" for multiple users without needing a For Each?

Script 1: $useremail = $workflow.SavedObjectProperties("searchforobjects").get("mail")

Error: At line: 11 char:5. Exception calling "SavedObjectProperties" with "1" argument(s): "The given key was not present in the dictionary."

Script 2: $useremail = $workflow.FoundObject("searchforobjects").get("mail")

Error: At line: 8 char:5. Exception calling "Get" with "1" argument(s): "Object reference not set to an instance of an object." 

Parents
  • The Search itself sets up the For each for you.

    Anything you place in the workspace of the Search is executed for each returned object.

    Your "Script 2" example is the way I would approach this.

    The key is making sure that you are referencing the name of your Search Activity correctly:

    So if my Search is Called "FindManagers"

    $useremail = $workflow.FoundObject("FindManagers").get("mail")

    I'm not sure if you actually can ask for the "mail" property directly this way or if you have to do it like this:

    $user = $workflow.FoundObject("FindManagers").get("distinguishedname")

    $usermail = Get-QADUser -Identity $User -includedproperties mail | select -ExpandProperty mail

  • To clarify this:

    Anything (any activity) you place in the workspace of the Search (that is the gray box immediately below the Search Activity) is executed for each returned object.

Reply Children
  • Thanks   - that along with a couple of other bits has moved the issue along. 

    The problem i now have is my workflow search filter needs to look for users where the edsvaDeprovisionStatus is not 1 (i.e not deprovisioned). I have compared a deprovisioned user and one a user that i want to deprovision and the difference is that the deprovisoned user has their edsvaDeprovisionStatus as 1 however in my search if i set it to either "does not equal 1" or "is empty" my powershell script will not detect the users and trigger the workflow. 

    Any suggestions? 

  • What, if any, other criteria are you using in your Search?

    Would you be able to post a screen cap of the Search Activity configuration?