Hello,
Yes, it should be done using a PowerShell script. To handle the cases when the property is updated in Adaxes, you need to use a business rule triggering After updating a user. However, if the changes are made outside of Adaxes, the rule will not trigger. To make sure that such cases are also handled and all current property values are trimmed accordingly, use a scheduled task. Both the business rule and the scheduled task will use the below script. In the script:
- $propertyName - Specifies the LDAP name of the property to update.
- $characterToTrim - Specifies the character that should be trimmed from the beginning of the property value.
- $pipelined - Specifies whether the update will be passed through Adaxes pipeline. If set to True, corresponding business rules will trigger, log records will be created, etc.
$propertyName = "employeeID" # TODO: modify me
$characterToTrim = "0" # TODO: modify me
$pipelined = $True # TODO: modify me
# Get current property value
$targetObject = $Context.BindToObjectByDNEx("%distinguishedName%", $pipelined)
$currentValue = $targetObject.Get($propertyName)
# Update property
$newValue = $currentValue.TrimStart($characterToTrim)
$targetObject.Put($propertyName,$newValue)
$targetObject.SetInfo()
Finally, you should have something like the following:
Business rule
Scheduled task