Hello Boris,
First of all, you need to remove the IP Phone property from Web interface forms. For details, see https://www.adaxes.com/tutorials_WebInterfaceCustomization_CustomizeFormsForUserCreationAndEditing.htm.
As for updating the property, it can be done using a business rule triggering After creating/updating a user and the below PowerShell script. In the script:
- $propertyToSet – Specifies the LDAP name of the property to update.
- $sourcePropertyName – Specifies the LDAP name of the property whose characters will be used for the update.
- $numbreOfLastCharacters – Specifies the number of last characters to extract.
$propertyToSet = "ipPhone" # TODO: modify me
$sourcePropertyName = "description" # TODO: modify me
$numbreOfLastCharacters = 4 # TODO: modify me
# Get last cahracters
try
{
$sourcePropertyValue = $Context.TargetObject.Get($sourcePropertyName)
}
catch
{
$Context.LogMessage("Property $sourcePropertyName is not specified.", "Warning")
return
}
$charactersToSet = $sourcePropertyValue.SubString($sourcePropertyValue.Length - $numbreOfLastCharacters)
# Update the user
$Context.TargetObject.Put($propertyToSet, $charactersToSet)
$Context.TargetObject.SetInfo()