$request and $Dirobj not working to retrieve SamAccountName in workflow

Hello, I have a question about a powershell script We select a user in the Actives Roles (1) web interface. We have created a form (2) to change a virtual attribute (Activity Mutation 3) on a specific date (4). We fill out this form.

When the specific date is reached, a workflow is triggered and plays actions. Including a script that must modify several information on the user's Active Directory profile

But we are unable to retrieve the user's samAccountName. We tried $Request and $DirObj but it doesn't work. Can you help us ?

function onPostModify($Request){

$prenom = $dirObj.Get("givenName")
$nom = $Request.Get("sn")

Activity encountered an error when running script 'CN=xxxxxxxxxxxxxxxxxxxxxxxx,CN=Modif,CN=xxxxxxxx,CN=Script Modules,CN=Configuration'.
 Details <<<
At line: 163 char:2. Exception calling "Get" with "1" argument(s): "The directory property cannot be found in the cache. "





Best Regards,

Parents Reply
  • Just to elaborate / clarify Stu's suggestion above, when placed into the "workspace" of your search activity, the code to retrieve the $objDN as  suggests will execute for EACH OBJECT returned by the search.  You can then take that $ObjDN and use it to retrieve the additional user object attributes you need using Get-QADuser or Get-ADUser as you see fit.

Children