Add the PowerShell script listed below into your workflow and set up an Update Value stencil to execute it as shown in the screenshot below. This script will categorize the results as FoundActive, FoundNotActive, or NotFound, storing them in an Index Field named FBAccount for easy reference.
Make sure to update the script with the Index Field that holds the email address. In this case, the script is specifically referring to Index Field 19.
Function Ck4ActiveFBAcct(){
# Create a new UserCollection object
$uc = New-Object FileBound.UserCollection
$Context.Business.WireCollection($uc)
# Set up filter by email listed in Index Field 19
$uc.Filter.Email = $Context.File.Field[19]
# Fill the Users collection
$uc.Fill() | Out-Null
# Check if users were found
if ($uc.Count -gt 0) {
# Return "FoundActive" if user found and active
if ($uc[0].Active -eq $True) {
return "FoundActive"
# Return "FoundNotActive" if user found and not active
} else {
return "FoundNotActive"
}
} else {
# Return "NotFound" if user not found
return "NotFound"
}
}