In a workflow, pass attributes of new object to a script

Another newbie question, I am trying to do something seemingly simple but I'm racking my brain and had enough of scrolling the SDK (why is it in a format from the 90's?)

Essentially, I have a WF which creates a new user object, I need to pass a number of attributes of the new user obj to a PS script. I've been exploring $Request.Get() and $context inside the script but I can't seem to get the script to read the new users attributes.

Any help is appreciated because I am bamboozled

  • The workflow wouldn't pass attribute values to a script, but Active Roles does provide a reference to newly created object for the script to then get the values it needs. Search the SDK for $DirObj.

  • I'd also recommend having a look at this video by Chris Rudd, its from a session at Unite, I think from 2023 (possible 2022). It gives a good intro to Requests in Active Roles, plus pre and post processing.

    The Request Object: The Heart of Active Roles (oneidentity.com)

    As Richard mention, there SDK has some fantastic information on the DirObj Object, but also has information on the Request Object, both are really important to understand.

    For example $Request (the request object) contains a property bag of attribute/properties and the value being set as part of a request (plus operational in process values), but it does not contain any property not being set/cleared/replaced as part of the current request.

    Where as $DirObj contains values of the object as it is currently stored in Active Directory.

    Where the $Request and $DirObj objects are called in a script is important, and there are limitations to where they are available. But in general terms, $DirObj before an operation (create, update etc) is executed contains the value held in AD currently, after the operation it would be the value you've just set, not the original value.

  • Whilst my post was being moderated, I figured out that after the "Create" activity, I can add a "Save Object Properties" activity and point it's Activity Target to the "Create" activity. Then in my script I can use $workflow.SavedObjectProperties("Name of saved object properties").Get("propertyName")