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 (920 points)

1 Answer

0 votes
by (216k 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 (920 points)
0 votes
1 answer

We would like to be able to, possibly through a script or report, search for attributes that equal specific values and find all rule-based groups that used those rules. An ... and being able to list all rule-based groups that use that in their query set.

asked Oct 5, 2022 by wesmcmillan (20 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

Im trying to rename "Extension attribute 1 and 2" to something legible for users. Is there a way to cahnge the dsiaply name myslef like how other attributes are done?

asked Feb 17, 2023 by raul.ramirez (210 points)
3,326 questions
3,026 answers
7,727 comments
544,681 users