Passing user object to workflow script

Hi

I'm trying to get a workflow to run which will update extensionAttribute7 of a user object when it's been added to a group, based on the users job title.
e.g. Joe Bloggs gets added to the group, his title is IT, EA7 needs to be set to "03452"
Jane Bloggs gets added to the group, her title is Director, EA7 needs to be set to "56643".

My workflow identifies the correct user object, and if I specify the value of EA7 in the target properties as a text value, works fine, but because of the number of options for the value of EA7, I've had to create a script with a lookup table and I cannot figure out how to pass the users job title, or DN to that script.
I followed this KB to create the workflow and identify the user to be updated and my script will execute when it's specified in the Target properties.
(support.oneidentity.com/.../how-to-automatically-remove-a-user-from-specified-groups-when-being-added-to-another-specified-group)

I also read through this forum post, which helped me find the ActivityTarget method. I'm sure this must be what I need, but I can't get it to work.
(www.oneidentity.com/.../88312)

The best I can do is to use the lines

$user = $workflow.ActivityTarget
$user | Select * | Out-File E:\MC\Workflow\user.txtCode

Which then gives me this output

MemberType : Method
OverloadDefinitions : {System.Object ActivityTarget(string ActivityID)}
TypeNameOfValue : System.Management.Automation.PSMethod
Value : System.Object ActivityTarget(string ActivityID)
Name : ActivityTarget
IsInstance : TrueCode

But no matter what I change with the "$user = $workflow.ActivityTarget" line, I cannot get it to provide any information on the user object.
I've tried

$user = $workflow.ActivityTarget("Change object properties")
$user = $workflow.ActivityTarget("Add member to group")
$user = $workflow.ActivityTarget("Added member")

Which all produce an empty users.txt document, so I added the get method.

$user = $workflow.ActivityTarget("Change object properties").get("distinguishedName")
$user = $workflow.ActivityTarget("Add member to group").get("distinguishedName")
$user = $workflow.ActivityTarget("Added member").get("distinguishedName")

All of which result in "You cannot call a method on a null-valued expression" errors in the debug log.

Can someone please help point me in the right direction with this?

Many thanks

Matt

Parents Reply Children
No Data