Really strange ... as you can see, I added an else action to my business rule.
This is basically the same script/check as within the "if script returns true" condition.
During an test with updating group, the condition was not met, however the script shows matched pattern ...
Script:
$inputString = "%adm-DescriptionOfOperationToApprove%"
$inputString = $inputString.Trim()
$inputString2 = $inputString.Split("`n")
$pattern1 = "^Create.*\XXX\\Group Creation (Development|Portfolio|Domain)\).*$"
$pattern2 = "^Run PowerShell script 'Update group and owner group' for .*?\XXX(Development teams|Domains|Portfolios)\).*$"
$Context.LogMessage("$inputString", "Information")
$Context.LogMessage("$inputString2", "Information")
$Context.LogMessage("$pattern1", "Information")
$Context.LogMessage("$pattern2", "Information")
if ($inputString -match $pattern1) {
$output = "Matched pattern 1: Create Group Creation"
$Context.LogMessage("$output", "Information")
}
elseif ($inputString -match $pattern2) {
$output = "Matched pattern 2: Update Group and Owner Group"
$Context.LogMessage("$output", "Information")
}
else {
$output = "No match found"
$Context.LogMessage("$output", "Information")
}