Updating user attribute from workflow using script lookup

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 job title.

e.g. Joe Bloggs gets added to the group, his titlle 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, that's fine, but because of the number of options for the value, 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.

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.

The best I can do is to use the lines

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

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          : True

But no matter what I change with the first line, I cannot get it to provide any information on the user object.

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

Many thanks

Matt