This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

First.Last to DN Workflow

We've got Okta pushing manager first.last to extensionAttribute3 in ARS. I need a workflow that will convert that to a DN to drop into the manager field. However, no matter what I do, it doesn't want to get from any attributes.

Workflow setup:

On Demand
EA3 Search - Filters from an OU with 4 users. No other filters in place. --> Run Script: First.Last to DN


First.Last to DN script

function onPostModify($Request)
{
$sourceObj = $workflow.FoundObject("EA3").get("DN")
$manager = get-aduser -identity $sourceObj -properties extensionattribute3 | select -expandproperty extensionattribute3
$managerDN = (get-aduser -id $manager).distinguishedname	
$dirobj.put("manager", $managerDN)
$DirObj.SetInfo()
}



The error I get when I try to run the workflow with the script is:

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

 

Parents
  • The error message is on line 3, where you are calling the workflow.FoundObject("EA3").get("DN")

    You don't have a check for $NULL. There is nothing being returned by the search.

    Is there any reason why you are scripting this? It can be done completely in a Workflow, no scripting necessary.

  • Is there any reason why you are scripting this? It can be done completely in a Workflow, no scripting necessary.

    Ignorance honestly. I wasn't aware that I was able to do this with strictly a workflow.

    When Okta drops a new user into AD, I need to be able to pull out a first.last in a custom field into a DN to place into the Manager field. I really need it to go onCreate. However, my first instance of this was via an onCreate workflow with a variation of the above script. 

  • Are your samaccountname attributes meeting the firstname.lastname format? Are you getting anything else from the source data system, like an employee ID?

    You might not be getting a valid result off a straight search.

Reply Children
No Data