Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Database rules. Same action for different conditions.

SOLVED
Go to solution
Highlighted
Meine de Vries
Regular Collector

Database rules. Same action for different conditions.

I am trying to send an email for 2 different conditions that occur.

1 - when a service call is assigned to certain organizations, and
2 - when that service call is finally closed for some of those organizations.

Below you wil see the text of the condition:

When service call is created
OR When service call is modified
where (
( Organization (*) equals A
OR Organization (*) equals B
OR Organization (*) equals C
OR Organization (*) equals D
OR Organization (*) equals E
OR Organization (*) equals F)
OR ( Status (*) equals Closed
AND ( Organization equals A
OR Organization equals B
OR Organization equals C
OR Organization equals D)))

This does not appear to be working. When ever the status from, lets say Organization E, changes an email is send.

I know I can do this differently with 2 database rules and that indeed works fine, but in an effort to reduce database rules and have a more consistent apearance of the email messages I would like to do this in one rule.

Thanks, Meine
10 REPLIES
George M. Meneg
Honored Contributor

Re: Database rules. Same action for different conditions.

Hello,

It's better to do it in two rules. Complex rules tend to choke OVSD and take more time to process.
menes fhtagn
Raman Shcharbak
Frequent Visitor

Re: Database rules. Same action for different conditions.

It seems to me that you forgot to metion "and Status not equals Closed" subcondition in first part (in brackets) of condition. So the first part will always get a hit.
Thorfinn Thomas
Regular Collector

Re: Database rules. Same action for different conditions.

Hello,

Even if you specify "and Status not equals Closed" (quote: Roman), it will still fire when any other update to the servicecall occurs and the conditions are met - even when status is changed to something other than 'closed'.

I had a similar case, and in lack of the possibility to check what attribute has changed, I decided to create a hidden custom boolean attribute that is altered when the rule fires, and have the rule check for that attribute as well.


regards,
Thorfinn
Raman Shcharbak
Frequent Visitor

Re: Database rules. Same action for different conditions.

May be "Evaluate this rule for this field" checkbox will help you. This condition would trigger only if mentioned in condition attribute will change. (SD5, not shure that this checkbox is in 4.5)
George M. Meneg
Honored Contributor

Re: Database rules. Same action for different conditions.

The execution of the rule is correct.

According to the criteria it should be evaluated in these conditions

1. Ticket is created and organization is one of A,B,C,D,E,F (TRUE OR FALSE = TRUE)

2. When Service Call is modified and one of the modifications is the organization fields (TRUE OR FALSE = TRUE)

3. When Service call is modified, one of the modifications is STATUS=CLOSED AND organization is one of A,B,C,D (FALSE OR TRUE = TRUE)

Also, if in the same ticket, both STATUS and ORGANIZATION is modified then the e-mail will be also sent and it is correct.

Let's say you set ORG=E and STATUS=Closed

then you have TRUE OR ( TRUE AND FALSE) = TRUE or FALSE = TRUE, so the e-mail will be sent.

I 'll say it again: Make it two rules. Complex rules tend to choke OVSD and they are more difficult to debug.
menes fhtagn
Meine de Vries
Regular Collector

Re: Database rules. Same action for different conditions.

First I do check what attributes are changing. The (*) indication in the condition indicates that the "Evaluate this rule for this field" has been checked.

I my opinion the action (send email) did not fire correctly.

I think the condition says:

1 - send email whenever the Organization is changed to A to F, OR
2 - send email whenever the Organization is A-D, regardless whenever that was set to that value, AND the status changed to Closed.

So:

If I create a ticket and set the organization to E, no matter what the status is, and save the ticket an email should be send. Condition 1 = TRUE so send email. (And this happens).

Next I change the status of said ticket to 'In Progress' (and make no other changes) no email should be send. Condition 1 = False (no Organization was changed), Condition 2 = False, status unequal 'Closed', and Organization not equal A-D.

However in the above example an email is send, which seems that OVSD misinterprets the rule.

Thank you all for your response, but I guess unfortunately I need to stay with two (or more) rules.
Cy Wong
Super Collector

Re: Database rules. Same action for different conditions.

I think with "Evaluate this rule for this field" enabled, all the fields with (*) will be able to trigger the whole rule.

In you example, even if you only change the Status, the whole rule's conditions are evaluated, including the first part of the condition.

So as Roman suggested, putting "and Status not equals Closed" subcondition in first part (in brackets) of condition may solve your problem?
Solution

Re: Database rules. Same action for different conditions.

Hello,
You are not right

"I my opinion the action (send email) did not fire correctly.

I think the condition says:

1 - send email whenever the Organization is changed to A to F, OR
2 - send email whenever the Organization is A-D, regardless whenever that was set to that value, AND the status changed to Closed."


This rule says "whenever service call modified and one of fields (status or orgs a..f) is modified only then check field values and ignore which field was changed:
1 - send email whenever the Organization is changed to A to F (and dont check if status was changed or not), OR
2 - send email whenever the Organization is A-D, regardless whenever that was set to that value, AND the status changed to Closed."
Raman Shcharbak
Frequent Visitor

Re: Database rules. Same action for different conditions.

The rule seems correct. I`ve found out how service desk interpret it. It will fire if ANY of (*) attributes(with checked "Evaluate this rule for this field") that participate in condition was changed. So, when changing status, which is a (*) field, it doesn`t matter whether organization was modified, the rule will fire if all conditions are met. So, if you will change for example information attribute - the rule will not fire (there are no changed attributes that are in condition). You can turn on debug and see all the logic in rules.log file. So, (*) just indicates what fields (at least one of) must be changed to begin evaluation of this rule. That is the clue!
Meine de Vries
Regular Collector

Re: Database rules. Same action for different conditions.

Thank you all for your response. Now I understand why the database rule fired. I will try to accomplish the task of just having one place to send the email differently, but that will probably be a whole new discussion.

Thanks, Meine
//Add this to "OnDomLoad" event