I am building a workflow for Employee Onboarding and my chain has quite some Powershell Orchs.
Whenever use “Test App Action” my scripts/command work without any issue and I get the result I expect in the “result” field. However, when I execute the workflow and my AD Create User Orch app OR my simple “Add note” I use for debugging now have to fill in the placeholder {{A3.result}} which should look like firstname.lastname, it fills in blanks. I have tried using liquid filters to remove whitespaces etc, but no change. I have never had any issues with result placeholders whatsoever before. Ever since I added the GetADUser parts it bugs out for some reason. I have no issues when performing this on the DC itself.
It’s not the only instance of the workflow that has this issue. Can this be some bug?
This is one of the payloads:
function Convert-ToEmailFriendly {
param(
rstring]$name
)
$normalized = $name.Normalize(mText.NormalizationForm]::FormD)
$noDiacritics = $normalized -replace '\p{Mn}', ''
$emailFriendly = $noDiacritics -replace ' ', '.' | ForEach-Object { $_.ToLower() }
return $emailFriendly
}
function Check-UPN {
param(
string]$emailFirstName,
[string]$emailLastName
)
$emailAddress = "$emailFirstName.$emailLastName"
$upn = "$emailAddress@company.com"
if (Get-ADUser -Filter "UserPrincipalName -eq '$upn'" ) {
$emailAddress = "$emailLastName.$emailFirstName"
}
return $emailAddress
}
Import-Module ActiveDirectory
$firstName = "{{ticket.ri_132_cf_employee_first_name}}"
$lastName = "{{ticket.ri_132_cf_employee_last_name}}"
$emailFirstName = Convert-ToEmailFriendly -name $firstName
$emailLastName = Convert-ToEmailFriendly -name $lastName
$emailFullName = Check-UPN -emailFirstName $emailFirstName -emailLastName $emailLastName
Write-Output $emailFullName