ObjectLast Updated: September 09, 2019
We designed Spiff for business users. So Spiff will feel similar to using your favorite spreadsheet like Excel or Google Sheets. Spiff supports an increasing range of the same functions you will find in spreadsheets.
But building the complex logic of a commission plan often requires more powerful tooling than what you can find in spreadsheets alone. For example, you will often need to access and filter data from connected systems.
To handle this, Spiff allows you access to all of the data in your connected systems like Salesforce, Netsuite, or Stripe. The data in these connected systems, and in all modern data systems, are organized as objects.
In computer science, the word "Object" refers to an instance of a class. What is an "instance of a class?"
Classes are just templates or models of real-world things. So imagine you wanted to create a template for every "sales deal" in your company. You want to create this template so that you can start to track data about every deal your company closes. We'll call this model the "Deal" class. What are the things that every sales deal typically has? Well here are few things most sales deals have:
- A closing date
- An amount of money
- A person who closed the deal
- A buyer
Let's call these things you want to track for every deal "attributes." So Objects can have attributes. Let's assume you decide that you only care about these 4 attributes of the deals that you close at your company.
Once you create a Class and its standard attributes, you can create an infinite number of instances of that class. To understand instances, let's go back to our Deal class.
Let's say your company closes only two deals and you want to track them. Remember, we decided above you only care about those 4 attributes above. So you pull out a sheet of paper and you write down the following:
- Close date: 1/1/2019
- Amount of money: $100
- Closer: Abby Wombach
- Buyer: Carli Lloyd
- Close date: 2/1/2019
- Amount of money: $50
- Closer: Lionel Messi
- Buyer: Cristiano Ronaldo
Congratulations! You have created two instances of your Deal object!
Once you understand this, you understand a huge amount about how modern software systems work.
For example, modern CRMs have already created deal objects for you. In Salesforce, it is called the Opportunity Object. Salesforce has already created the deal template for you. Their template has far more than just the 4 attributes that we mentioned above. In fact, it has hundreds of attributes. And you can also create additional custom attributes if you feel that Salesforce left one out that you might need.
Object Attribute Syntax: The . (Dot) Operator in Spiff
Once you understand the basics of objects, you'll need to understand one more little thing to become an expert at Spiff--the dot operator.
Before we jump into the example, let's assume you moved the information about your company's 2 deals (above) from paper into a computer database. Let's assume you could give some information to that computer and it would go find stuff in its database.
That's basically what the "." operator does. The dot operator, just allows you to get the value of the attribute of an instance of an object. This syntax usually looks like this:
What comes in front of the "." is the name of instance of an object. What comes after the "." is the attribute of that instance you want.
You can probably already guess how this works.
The part in front of the dot says "deal2". For a variety of reasons computer languages often require that you write things in special ways. We'll explain why in another post. But for now, just assume that the computer understands that when you type "deal2" it is going to its database and find the entry for Deal 2.
The part after the dot says "buyer". Can you guess what the computer is going to look for at this point? It already went and looked up the database entry for Deal 2 and now you are asking it for the "buyer".
So if you typed "deal2.buyer" into our hypothetical computer and database, what do you think the computer would return to you?
It would return the name "Christiano Ronaldo." Now you understand the basics of objects and how they work.
Spiff has a lot of objects. Most of these objects correspond to similar objects in the CRMs, accounting systems, payroll systems, or payment systems with which we integrate. We'll make this list comprehensive over time but here are several examples:
- Line Items
- Order Items
- Pricebook Entries