0 votes

Have a custom new user form that has a list of departments and I am trying to append the description so if the someone selects multiple departments, the multiple departments are listed in the description.

Current simplified business rule:

If(location name)property equals (location) then
Modify the user: set Description to '(location)'

Further down in the rule:

If (department name) property equals 'Yes' then
Modify the user: set Description to '%description% (Department Name)

Seems to work fine when I only do one department. Getting a description of (location) (Department Name), but if multiple departments are selected, the description just changes to (location) (last department selected). According to the execution log: the previous department name just gets overwritten.

Any ideas?

by (60 points)
reshown by
0

Hello,

Sorry for the confusion, but we are not sure what exactly you have configured. The department property is singlevalued and there is no possibility to specify multiple departments in it. Could you, please, post here or send us (support@adaxes.com) a screenshot of the business rule you have?

0

Sorry,

I have created custom attributes for each of our departments because I could not use the department field, since it only allows a single choice.

When I say department name, I'm just referring to the custom attributes that have been created.

0

Hello,

Thank you for clarifying. For us to suggest a solution, please, provide a screenshot of the custom form with all the attributes that correspond to location and department names. You can post the screenshot her or send to us at support@adaxes.com.

1 Answer

0 votes
by (289k points)

Hello,

Thank you for the provided details and screenshots. The thing is that you have all the actions for updating the description property set in a single custom command right after each other using value reference %description%. All value references resolve into the corresponding values before executing the entire custom command (same works for business rules and scheduled tasks). As such only the last action in your command for incrementing description will work. This behaviour is by design and cannot be changed. To achieve the desired, you need to use the below script instead of all the actions/conditions in your custom command. In the script:

  • $propertyToIncrementName – Specifies the LDAP name of the property whose value will be incremented.
  • $propertyValueMap – Maps LDAP names of Boolean properties with the values that will be incremented to the value of the property specified in variable $propertyToIncrementName.
$propertyToIncrementName = "description"  # TODO: modify me
$propertyValueMap = @{
    "adm-CustomAttributeBoolean1" = "Tournament Office"
    "adm-CustomAttributeBoolean2" = "Bowler Service"
    "adm-CustomAttributeBoolean3" = "Bowling Ball Express"
    "adm-CustomAttributeBoolean4" = "Brackets"
    "adm-CustomAttributeBoolean5" = "Check In/Entries"
    "adm-CustomAttributeBoolean6" = "Finance"
    "adm-CustomAttributeBoolean7" = "Lane maintenance/Tech"
} # TODO: modify me


# Get value of the property to increment
try
{
    $propertyValue = $Context.TargetObject.Get($propertyToIncrementName)
}
catch
{
    $Context.LogMessage("Property $propertyToIncrementName is empty.", "Warning")
    return
}

# Get values to increment
$valuesToIncrement = @()
foreach ($keyValuePair in $propertyValueMap.GetEnumerator())
{
    try
    {
        $addValue = $Context.TargetObject.Get($keyValuePair.Name)
    }
    catch
    {
        continue
    }

    if($addValue)
    {
         $valuesToIncrement += $keyValuePair.Value
    }    
}

# Increment values
foreach ($value in $valuesToIncrement)
{
    $propertyValue = $propertyValue + $value
}

# Update the user
$Context.TargetObject.Put($propertyToIncrementName, $propertyValue)
$Context.TargetObject.SetInfo()

Related questions

0 votes
1 answer

Hello, I am running a scheduled task that disables an inactive account then it updates the description with information stating Adaxes disabled the account. However, the user' ... disabling the accounts so it doesn't overwrite the description but appends it.

asked Jan 20, 2023 by mightycabal (1.0k points)
0 votes
1 answer

I am trying to create a report, that searches the extension attribute40 of all users for a username. I tried the report with "Active Directory search (param-Username)" and script. I would be glad about a tip

asked Dec 8, 2022 by boris (530 points)
0 votes
1 answer

Receive "Index operation failed; the array index evaluated to null. Stack trace: at <ScriptBlock>, <No file>: line 104>" and "Index operation failed; the ... $GroupName, $GroupDN." } } #foreach write-output "" Write-Output "" Stop-Transcript

asked Apr 14, 2022 by jbahou (20 points)
0 votes
1 answer

Getting "object reference not set to an instance" when trying to sign into Office 365 Tenant Was working fine before

asked Sep 1, 2021 by davm79 (40 points)
0 votes
1 answer

Good afternoon, I am attempting to create a report to flag Users where the email address in AD does not match the email address in our Payroll system. I am able to use ... ) to grab User objects. Any help or input would be greatly appreciated. Thank you, Keith

asked Aug 12, 2021 by kfrench (20 points)
3,547 questions
3,238 answers
8,232 comments
547,809 users