Skip to content

When using multiple rules and different UseAdditionalField per rule module will fail #8

@PrzemyslawKlys

Description

@PrzemyslawKlys
[ordered] @{
    Enable               = $false # doesn't processes this section at all if $false
    RemindersDisplayOnly = $false # prevents sending any emails (good for testing) - including managers
    SendToDefaultEmail   = $true # if enabled $EmailParameters are used (good for testing)
    Reminders            = 1, 7, 14, 15 # both dictionary and array works for reminders
    UseAdditionalField   = 'extensionAttribute13'
    SendCountMaximum     = 3
}
[ordered]@{
    Enable               = $false # doesn't processes this section at all if $false
    RemindersDisplayOnly = $false # prevents sending any emails (good for testing) - including managers
    SendToDefaultEmail   = $true # if enabled $EmailParameters are used (good for testing)
    Reminders            = 3, 9
    UseAdditionalField   = 'extensionAttribute12'
    SendCountMaximum     = 3
}

The code checks AdditionalProperties for User & Manager, but it assumes it's a string - not multiple strings

$UserManager = $CachedUsers["$($_.Manager)"]
if ($AdditionalProperties) {
# fix this for a user
$EmailTemp = $_.$AdditionalProperties
if ($EmailTemp -like '*@*') {
$EmailAddress = $EmailTemp
} else {
$EmailAddress = $_.EmailAddress
}
# Fix this for manager as well
if ($UserManager) {
if ($UserManager.$AdditionalProperties -like '*@*') {
$UserManager.Mail = $UserManager.$AdditionalProperties
}
}
} else {
$EmailAddress = $_.EmailAddress
}

This will require some advanced logic depending on which rule we're working on. Not a top priority as I guess it would be not likely that multiple rules would be running within the same domain with different overwrite email fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions