We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.

Script repository

Send multi-value property values via email

February 24, 2021 Views: 1029

The script sends an email notification containing all values of a multi-value property. To run the script, you can use a custom command, a business rule or a scheduled task configured for the corresponding object type (e.g. user).

Parameters:

  • $propertyName - Specifies the LDAP name of the property whose values will be included into the email notification.
  • $to - Specifies the recipient's email address.
  • $subject - Specifies the email notification subject.
  • $messageTemplate - Specifies a template of the email notification. In the template, the {0} placeholder will be replaced with values of the property spacified in the $propertyName variable.
Edit Remove
PowerShell
$propertyName = "adm-CustomAttributeTextMultiValue1" # TODO: modify me

# E-mail settings
$to = "recipeint@domain.com" # TODO: modify me
$subject = "Values of '$propertyName' property" # TODO: modify me
$messageTemplate = "Values: {0}" # TODO: modify me

# Get property values
try
{
    $values = $Context.TargetObject.GetEx($propertyName)
}
catch
{
    $values = $NULL
}

if ($values -eq $NULL)
{
    $values = "Not specified"
}
else
{
    $values = [System.String]::Join(";", $values)
}

# Build message
$message = [System.String]::Format($messageTemplate, $values)

# Send mail
$Context.SendMail($to, $subject, $message, $NULL)

Comments 0
Leave a comment
Loading...

Got questions?

Support Questions & Answers