Hello,
I am having an issue passing a variable from one workflow to another. If I use a hard-coded variable, it seems to work without issue. Basically, I have two workflows: one that grabs information about the user from Active Directory, and the other that updates a SharePoint list based on that returned data. Below are my scripts:
Workflow Get-User { param( [string]$SamAccountName ) $DomainController = Get-AutomationVariable -Name "Domain Controller" $Credentials = Get-AutomationPSCredential -Name "Administrator" $User = InlineScript { Get-ADUser -Filter { SamAccountName -eq $Using:SamAccountName } } -PSComputerName $DomainController -PSCredential $Credentials $ObjectGUID = $User.ObjectGUID Update-Employee -ObjectGUID $ObjectGUID -TelephoneNumber "+12312345678" }
workflow Update-Employee { param( [string]$ObjectGUID, [string]$TelephoneNumber ) $SharePoint = Get-AutomationVariable -Name "SharePoint" $Credentials = Get-AutomationPSCredential -Name "SharePoint Farm" inlinescript { Add-PSSnapin Microsoft.SharePoint.PowerShell $Web = Get-SPWeb -Site http://sharepoint $List = $Web.Lists["List"] $Item = $List.Items | Where-Object {$_['Object_x0020_GUID'] -eq $Using:ObjectGUID} $Item["Work_x0020_Phone"] = $Using:TelephoneNumber $Item.Update() $Web.Dispose() } -PSComputerName $SharePoint -PSCredential $Credentials -PSAuthentication CredSSP }
When I run...
Get-User -SamAccountName jdoe
I receive the following error:
"Cannot index into a null array"
Any help?
- Moved by Daniel JiSunMicrosoft contingent staff, Moderator Monday, March 30, 2015 8:43 AM