A customer has recently asked me what was the best way to send out alerts for a list item/document change, where the alert recipient is dynamically resolved from a field. I came up with a PowerShell script to create an alert that uses the DynamicRecipient property, passing  the field internal name.

$webUrl = "http://localhost/web" #Site URL
$listTitle = "Documents" #List Title
$alertTitle = "Dynamic Alert" #Alert Name
$fieldName = "Author" #Field to retrieve user from - must be internal name.

$web = Get-SPWeb $webUrl
$list = $web.Lists[$listTitle]
$alert = $web.Alerts.Add()
$alert.Title = $alertTitle
$alert.List = $list
$alert.DynamicRecipient = $fieldName
$alert.DeliveryChannels = [Microsoft.SharePoint.SPAlertDeliveryChannels]::Email
$alert.EventType = [Microsoft.SharePoint.SPEventType]::All
$alert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Immediate