0 votes

Dear Support,
can you please advise a multivalue attribute can be properly addresses in a report?
I want to add a custom calculated column to the report, value of which is based on user multivalue attribute.
E.g. if attribute is:
A
B
C
to show B in calculated column.
But when I do If ($Context.GetParameterValue("%adm-CustomAttributeTextMultiValue1%") -contains "B") - it always fails, since GetParameterValue returns always C. Is there a way to loop through it in report? I cannot see $Contenxt.TargetObject there... :(
I would appreciate your help!
Thank you!

by (850 points)

1 Answer

0 votes
by (215k points)
selected by
Best answer

Hello Dmytro,

can you please advise a multivalue attribute can be properly addresses in a report?
I want to add a custom calculated column to the report, value of which is based on user multivalue attribute.
E.g. if attribute is:
A
B
C
to show B in calculated column.

Value references of multi-value attributes resolve only into the last value of the attributes. To iterate through all the values of a multi-value attribute, you need to bind to the object (e.g. using the $Context.GetADObject method) and use the GetEx method to get the property values. The script should be like the following:

$propertyName = "adm-CustomAttributeTextMultiValue1" # TODO: modify me
$valueToCheck = "B" # TODO: modify me

# Get AD object
$user = $Context.GetADObject()

# Get property value
try
{
    $values = $user.GetEx($propertyName)
}
catch
{
    $values = @()
}

# Set column value
if ($values -contains $valueToCheck)
{
    $Context.Value = $valueToCheck
}
else
{
    $Context.Value = $NULL
}

In the script:

  • $propertyName – specifies the LDAP name of the multi-value attribute for check;
  • $valueToCheck – specifies a value for search in the attribute specified for the $propertyName variable.

But when I do If ($Context.GetParameterValue("%adm-CustomAttributeTextMultiValue1%") -contains "B") - it always fails, since GetParameterValue returns always C.

The GetParameterValue method is used to get values of report parameters and requires a parameter name as its argument. It cannot be used to get values of object properties.

For your information, in scripts for generation of a report or report custom column value references resolve into values of corresponding properties of the user that is generating the report.

0

Thanks a lot! That solved all my questions :)

Related questions

0 votes
1 answer

We're utilizing the custom adaxes attributes for a few parts in our employee onboarding procedure. Among them is a step where we specify what buildings a user will need ... get all the values of "adm-CustomAttributeTextMultiValue1" to be sent out in an email?

asked Aug 9, 2021 by KruzGaffaney (50 points)
0 votes
1 answer

Dear Support, Is it possible in "generate default value" section of pattern for multivalued attribute to provide more than 1 value from "must be one of" section? E.g. Pattern ... E" and to have default generated values in web interface "A,C" Thanks for advise!

asked Jul 7, 2020 by Dmytro.Rudyi (850 points)
0 votes
1 answer

Hi! I need a report of user accounts with empty attributes. Is there a possibility to make such report? Thanks in advance.

asked Sep 11, 2009 by philip (20 points)
0 votes
1 answer

I am wanting to export a list of users including the properties of a specific custom attribute. Ideally, I would be able to run a get-admuser and filter on a custom attribute, but even an excel report with the custom attributes would work. Is this possible?

asked Sep 9, 2021 by ggallaway (300 points)
0 votes
1 answer

I would like to show a couple of Adaxes Virtual Attributes in the Web Portal. I've added them in the Configuration, see the 1st screenshot below. I've ... . Any help? Virtual Attributes added Security Role has permissions Virtual Attributes not showing up

asked Jul 29, 2020 by nate2 (90 points)
2,740 questions
2,474 answers
6,475 comments
1,373,651 users