I have a 'Before user account creation' business rule that starts as follows:
If script 'Validate user exists' returns true then
Do Nothing
// rest of validation occurs.
The script 'Validate user exists' has an LDAP filter to check if there exists a user account with the same sAMAccountName or Mail as the desired user creation and if so, throws '$Context.Cancel' and '$Context.ConditionIsMet = $False'.
In the adaxes SDK, it mentions "If your script is executed by a business rule that is triggered before an operation is performed, the $Context.Cancel method will cancel the execution of the operation. The method also cancels all business rule actions that are scheduled for execution after running the script.
I just had a case where the business rule fully executed itself (apparently ignoring the $Context.Cancel) but the user creation subsequently failed with the error 'The specified user account already exists'.
Regardless of the $Context.Cancel which should terminate the rest of the business rule, do I need to amend my initial validation block to resemble something like this?
If script 'Validate user exists' returns true then
Do Nothing
Else
-> Adaxe operation : Cancel this operation
// rest of validation occurs.
Or am I experiencing a bug where $Context.Cancel is not properly terminating the business rule.
Thanks.