Playbooks x – Operators and Functions – including examples

Here are the  operators and functions available for building playbook expressions. It is organized by the following:

  • Math Operators
  • Logical Operators
  • Date and Time Functions

Math Operators

  • + (Add) – Calculates the sum of two values.
  • – (Subtract) – Calculates the difference of two values.
  • * (Multiply) – Multiplies its values.
  • / (Divide) – Divides its values.
  • () (Open Parenthesis and Close Parenthesis) – Specifies that the expressions within the open parenthesis and close parenthesis are evaluated first. All other expressions are evaluated using standard operator precedence.

Date and Time Functions

  • DateTime.UtcNow  – NOW – Date time now in UTC time zone. The value includes date and time.
  • DateTime.UtcNow.AddHours( -n) – Add or subtract number of hours from today – Today plus or minus n hours. n must be numeric. DateTime.UtcNow returns date and time. So checking if something happened n number of hours ago would require using a range (>= and <=) and not just equal.
  • DateTime.UtcNow.AddDays( -n) – Add or subtract number of days from today – Today plus or minus n days. n must be numeric. DateTime.UtcNow returns date and time. So checking if something happened n number of days ago would require using a range (>= and <=) and not just equal.
  • DateTime.UtcNow.AddMonths( -n) – Add or subtract number of months from today – Today plus or minus n months. n must be numeric.
  • DateTime.UtcNow.AddYears( -n) – Add or subtract number of years from today – Today plus or minus n years. n must be numeric.

Examples

It is important to note that the rules reflect the state of compliance. So when the rule is TRUE no alert will be created. If you’d like to write it in a way that when the rule is TRUE a task is created, just add ! in front of the rule.

  1. Last email inbound date (email received) should be no longer than 14 days ago
( KomikoLastInboundDateTime >= DateTime.UtcNow.AddDays( -14 ) )

2. Last email outbound date (email sent) should be no longer than 7 days ago

( KomikoLastOutboundDateTime >= DateTime.UtcNow.AddDays( -7 ) )

3. Date for next meeting should be no longer than 30 days from now

( KomikoNextEventDateTime <= DateTime.UtcNow.AddDays( 30 ) )

4. Date since last meeting should be no longer than 90 days ago

( KomikoLastEventDateTime >= DateTime.UtcNow.AddDays( -90 ) )

5. Ensure responding  to emails received – check the emails sent date is always greater than email received

(KomikoLastInboundDateTime <= KomikoLastOutboundDateTime)

6. Response time to emails received should be less than 4 hours

(KomikoLastInboundDateTime <= KomikoLastOutboundDateTime) 
&& 
(KomikoLastInboundDateTime >= DateTime.UtcNow.AddHours( -4 ))

7. Post meeting email should be sent not more than one day later

(KomikoLastEventDateTime <= KomikoLastOutboundDateTime) 
&& 
(KomikoLastEventDateTime >= DateTime.UtcNow.AddDays( -1 ))

8. The Website field at the account level should not be  null

Website!=null

9. Number of contacts engaged in the last 30 days should be more than 2

(account.PeopleEngaged.30.Contacts.All.All >= 2)

10. Number of team members engaged in the last 30 days should be more than 3

(account.PeopleEngaged.30.Connections.All.All>= 3)

11. Number of emails sent (outbound)  in the last 90 days should be more than 7

(account.OutboundEmails.90.All.All>= 7)

12. Number of emails received (inbound)  in the last 30 days should be more than 3

(account.InboundEmails.30.All.All>= 3)

The expressions used in Playbook x are based on a subset of C# syntax.  See Syntax section for more information.

Was this article helpful?

Related Articles

Leave A Comment?