Create a ConditionLast Updated: September 16, 2019
Conditions are expressions that evaluate to "true" or "false." Scopes and Variables can use conditions. Scopes are ways to filter Objects in Spiff. You can filter any Object in Spiff with a Scope. They are similar to using Filters in your CRM like for example Filters in Salesforce.
Conditions allow you break down complex filters into smaller building blocks that you can combine. Spiff comes with several pre-built conditions that you can use for your Scopes.
Let's say you want to identify all deals closed by the rep whose Statement Spiff is calculating. Remember each statement has several built-in attributes/objects available to you in your functions. One of these built-in attributes is "rep". You can always reference the rep associated with a given statement. So if you wanted to create a Condition that a deal was closed by the rep, you could write:
deal.user_id == rep.id
Let's say you want to identify all deals closed within a the period of a Statement. You would accomplish this by writing this:
deal.booking_date >= statement_period.start_date AND deal.booking_date <= statement_period.end_date