Hello,
I'm creating users from an HR database's table and the creation is working fine, now I need to trigger an ARS wokflow that executes a script post-creation: the script is aimed to enrich user's data with information got from a CSV file that is stored on the server.
I've created the following Powershell script inside the ARS WF (triggered by Create User event):
function onPostCreate($Request) { $path = "C:\mypath" Set-Location $path $fname = $Request.get("givenname") $lname = $Request.get("sn") $csv = Import-Csv -Path $path\myfile.csv -Delimiter "," -Header 'Name','Surname','DATA1','DATA2','DATA3' foreach ($row in $csv){ if ( ($row.name -eq $fname) -and ($row.surname -eq $lname) ) { $data1 = $row.'DATA1' $data2 = $row.'DATA2' $data3 = $row.'DATA3' $Request.put("edsva-data1",$data1) $Request.put("edsva-data2",$data2) $Request.put("mobile",$data3) break } } }
This script is basically searching the just created user on the CSV file, retrieve the data from the file and write those data into the user's attributes but the command $Request.PUT isn't working. By looking at the script debug log it seems the attributes are set but when I check the values on users, they are empty.
I've managed to workaround this issue by using "Set-QADUser" instead of "$Request.Put" but I'd really like to know what I'm missing.
Thanks in advance.