0 votes

Thanks for the info.

I'm now grabbing the %adm-ManagerUserName% value, but need to remove the final 21 characters of it so it contains only their username and not our domain. Following the guidance of the Set-AdmUser cmdlet, I created the script below:

$user = $Context.TargetObject

$MgrUserName = "%adm-ManagerUserName%" $MgrUserName = $MgrUserName.SubString(0,$MgrUserName.length-21)

Set-AdmUser "$user" -Add @{"adm-CustomAttributeText39"="$MgrUserName"} -AdaxesService localhost

However when testing this in the PowerShell Script Editor for my business rule, I get the following error:

image.png

by (60 points)

1 Answer

0 votes
by (208k points)

Hello,

The error occurs because the identity passed to the cmdlet is incorrect. It should be done using the Put method.

Also, values represented by variables should not be wrapped by quotes. The correct way to trim strings in such cases is using the identifier of the corresponding character. In this case, the separating character is @. Finally, your script should look exactly as follows:

$MgrUserName = "%adm-ManagerUserName%"
$MgrUserName = $MgrUserName.SubString(0, $MgrUserName.IndexOf("@"))

$Context.TargetObject.Put("adm-CustomAttributeText39", $MgrUserName)
$Context.TargetObject.SetInfo()
0

Thank you, that worked perfectly! I appreciate your guidance to a PowerShell newbie.

Related questions

0 votes
1 answer

This is for license purposes and we do not want them visible in the Adaxes portal.

asked 3 days ago by jfrederickwl (20 points)
0 votes
1 answer

Adaxes version is 2018.2. I have build a custom report, and I don't want the 'Name' column with the pictures to appear in it. But it seem to be mandatory, it is greyed ... . Is there a way to remove / hide / or change the mandatory attribute or column ? Thanks

asked Jan 9, 2020 by Isabelle (50 points)
0 votes
1 answer

How do change the display name of a custom attribute in version 2017.2? All the information I am finding contains links that bring me to 2018 version

asked Nov 1, 2018 by hgletifer (1.2k points)
0 votes
1 answer

for example i add a form "create user for France" in the left pane, how can i translate it automatically when the UI in in French ? thank you

asked Apr 29 by GG (70 points)
0 votes
1 answer

Hello, I have a simple custom command that need to update the ProfilePath of Remote Desktop Services only if the current Profilepath starts with a specific value. I use the If ... the result is never true so the value is not updated. Thanks in advance. Ten

asked Dec 3, 2019 by tentaal (1.1k points)
2,575 questions
2,317 answers
6,176 comments
767,493 users