You can use triggers to perform automated actions in Upsales. For example, triggering a notification email to the team leader about a won deal.
This article covers:
- When triggers can be set up
- How to create a trigger
- Adding trigger criteria
- Why a trigger runs again every time a record is saved
- Set or copy a field value
- Trigger actions
- Tags in trigger actions
- Available tags
- Triggers on tickets
Triggers is part of the Product Workflow Automation
When triggers can be set up
Use triggers for creating, editing or removing:
- Company
- Contact
- Order
- Activity
- To-do and Phone call (accounts that use to-dos)
- Appointment
- Campaign
- Subscription (when subscriptions are activated)
- Project
- Product
- Ticket
- Your Custom Objects, under their own names
How to create a trigger
- Click Settings → Account → Business rules → Triggers:
- Click New trigger and enter a name and description:
- Select whether the trigger should run on creation and/or editing, or removal and click the of dropdown to choose what the trigger relates to. You can't change this after the trigger is saved:
- Select criteria for all or at least one that will run the trigger. To exclude match criteria, use the is/is not field:
- Add an action for what happens when the trigger criteria is met:
Adding trigger criteria
You can add many variants of match criteria.
For example, imagine you want to automatically notify your sales team when a new appointment is booked.
- Enter a trigger name and description
- Select your trigger to be run on the creation of an appointment
- Add match criteria of "Appointment type" and select the type of appointment you want to send the notification on:
- Add the action Send email and compose the email
Another example: an email whenever someone creates an order over 100 000.
- Select Creation of Order.
- Add the criterion Value in master currency Greater than 100000.
- Add the action Send email.
If you also select Editing, the email is sent again each time the order is saved. See Why a trigger runs again every time a record is saved.
Criteria with an empty value
A criterion with an empty value box is a valid criterion:
- Is with an empty value matches records where the field is empty. For a Yes/No field, it matches records where the field is not ticked.
- Is not with an empty value matches records where the field has a value.
Text fields and your own custom fields start with an empty value when you add them as a criterion. If you forget to fill in the value, the trigger only runs on records where that field is empty. Greater than and Less than always need a value.
Why a trigger runs again every time a record is saved
A trigger that runs on Editing checks its criteria against the record as it looks after each save. As long as the record matches, every save runs the actions again. For example, a trigger on Editing of Order with the criterion Value in master currency Greater than 100000 sends one email each time someone saves such an order, and a trigger on every company edit sends one email per edit.
Orders are an exception when someone edits and saves one order at a time (not a bulk update from a list). If every criterion of the trigger is one of Stage, Probability, Description, Date, Company or User, the trigger runs only when at least one of those fields changed in that save. Any other criterion, such as Value in master currency, a product or a custom field, makes the trigger run on every matching save.
Make a trigger run only once per record
- Create a Yes/No custom field on the object, for example "Notified" on orders.
- In the trigger, add the criterion "Notified" Is and leave the value empty (not ticked).
- Add the action that updates the same object (for an order, Update order). Click Add field, choose "Notified" and tick it.
The first time the trigger runs, it ticks the field. On later saves the field is ticked, so the record doesn't match and the actions don't run again.
Set or copy a field value
Use Update company (or Update contact, Update order, and so on) to set a field. Click Add field, choose the field and enter the value. To copy a value from the record, click Available tags and use a tag as the value, for example {{Client.Name}} to copy the company name into a field. Date fields have a list instead: pick Today under General, Clear field, or Choose a specific date.
- The value is copied when the trigger runs. If the source field changes later, the copy is not updated until the trigger runs again.
- A trigger only runs when a record is created, edited or removed after you save the trigger. Existing records are updated the next time they are saved, if the trigger runs on Editing.
- An action sets the same value on every record it runs on. To set different values depending on another field, create one trigger per value, each with a criterion for that case.
Examples:
- Tick a field on every new company: trigger on Creation of Company, no criteria, action Update company with the Yes/No field ticked.
- Set today's date the first time a company gets a website: trigger on Creation and Editing of Company, criteria Website Is not (empty) and your date field Is (empty), action Update company with the date field set to Today.
- Mark the company when it buys a product: trigger on Creation and Editing of Order, criterion Product Is the product (add Stage if only won orders count), action Update company with the company field set. Create one trigger per product.
To test a trigger on one record first, add a criterion such as Company Is your test company. When the result is right, remove that criterion so the trigger runs on all records.
Trigger actions
The actions are performed when the trigger's criteria are met. Which actions you can add depends on the object the trigger runs on (see Actions per object). Common actions are:
Create appointments and activities
Whenever the criteria for your trigger are met you have the option of creating an appointment. A useful feature to mention is the offset function. This lets you set the date of the appointment in the future by the number of days you select.
Update company
Whenever the criteria for your trigger are met you have the option of updating companies. This means adding or removing data like campaigns, categories, account managers, or the custom fields you've created for your Upsales account.
Send webhook
If you've got an external service you'd like to notify by a webhook, this is perfect. The action sends one HTTP request to the URL you enter, with the Method (POST, PUT, GET or DELETE), Headers and Body you set. The body can contain tags, so you can send details of the record.
Upsales doesn't read the reply, so a webhook can't bring data back into Upsales. A request that fails or times out (after 120 seconds) is not sent again. To change data in Upsales from the outside, the receiving service calls the Upsales API.
Send email
This feature is meant to notify your users of important events. By default, all notification emails will be sent from no-reply@upsales.com. However, you can change the sender email address.
- To link to the record in the email, use a tag in the link, for example https://power.upsales.com/#/open/client/{{Client.Id}} for the company or https://power.upsales.com/#/open/order/{{Order.Id}} for the order. See How to hyperlink to objects and entities inside Upsales for the other object types.
- Under Template, you can pick a document template. It is attached to the email as a PDF, for example to send the full order details.
- If the same email arrives again and again, see Why a trigger runs again every time a record is saved.
You can have multiple actions that are triggered at once. Each action can be added once, except Send email and Send webhook, which you can add several times.
Actions per object
Triggers that run on Creation or Editing can use these actions:
| Object | Actions |
|---|---|
| Company | Create activity, Create appointment, Update company, Send email, Send webhook |
| Contact | Create activity, Create appointment, Update company, Update contact, Send email, Send webhook |
| Order | Create activity, Create appointment, Update company, Update contact, Update order, Send email, Send webhook |
| Activity | Create activity, Update activity, Update company, Update contact, Update order, Send email, Send webhook |
| To-do | Create activity, Update to-do, Update company, Update contact, Update order, Send email, Send webhook |
| Phone call | Create activity, Update phone call, Update company, Update contact, Update order, Send email, Send webhook |
| Appointment | Create activity, Update appointment, Update company, Update order, Send email, Send webhook |
| Campaign | Create appointment, Send email, Send webhook |
| Subscription | Create activity, Update company, Update contact, Send email, Send webhook |
| Project | Create activity, Create appointment, Update company, Update contact, Send email, Send webhook |
| Product, Ticket | Send webhook |
| Custom Objects | Create activity (not for an object linked to a project), Update company, Send email, Send webhook |
In accounts that use to-dos, every object that offers Create activity also offers Plan phone call and Create to-do.
Triggers that run on Removal can use Send email and Send webhook (only Send webhook for Product and Ticket). Appointment also offers Update company, and Subscription offers the same actions as on creation.
Tags in trigger actions
Tags are a way of fetching dynamic data and placing them in your automatic trigger action. For example, by writing "Hello {{Client.Name}}!" in your action, it will render "Hello Company Inc!"
You can place tags on all trigger actions.
Available tags
The tag list in an action shows every tag you can use for the trigger's object. It includes tags for related objects, such as the company. Your own custom fields are in the list too, under their own names. The search matches the tag's name or the tag itself, such as {{Client.Name}}. These are the company and general tags:
Company
| Name in the list | Tag |
|---|---|
| Company: ID | {{Client.Id}} |
| Parent company (ID) | {{Client.ParentId}} |
| Name | {{Client.Name}} |
| Delivery address | {{Client.DeliveryAddress}} |
| Delivery address: Postcode | {{Client.DeliveryZipCode}} |
| Delivery address: Municipality | {{Client.DeliveryMunicipality}} |
| Delivery address: City | {{Client.DeliveryCity}} |
| Delivery address: State | {{Client.DeliveryState}} |
| Delivery address: Country | {{Client.DeliveryCountry}} |
| Visit address | {{Client.VisitAddress}} |
| Visit address: Postcode | {{Client.VisitZipCode}} |
| Visit address: Municipality | {{Client.VisitMunicipality}} |
| Visit address: State | {{Client.VisitState}} |
| Visit address: City | {{Client.VisitCity}} |
| Visit address: Country | {{Client.VisitCountry}} |
| Billing address | {{Client.InvoiceAddress}} |
| Billing address: Postcode | {{Client.InvoiceZipCode}} |
| Billing address: Municipality | {{Client.InvoiceMunicipality}} |
| Billing address: State | {{Client.InvoiceState}} |
| Billing address: City | {{Client.InvoiceCity}} |
| Billing address: Country | {{Client.InvoiceCountry}} |
| Postal address | {{Client.MailAddress}} |
| Postal address: Postcode | {{Client.MailZipCode}} |
| Postal address: Municipality | {{Client.MailMunicipality}} |
| Postal address: State | {{Client.MailState}} |
| Postal address: City | {{Client.MailCity}} |
| Postal address: Country | {{Client.MailCountry}} |
| Other address | {{Client.OtherAddress}} |
| Other address: Postcode | {{Client.OtherZipCode}} |
| Other address: Municipality | {{Client.OtherMunicipality}} |
| Other address: State | {{Client.OtherState}} |
| Other address: City | {{Client.OtherCity}} |
| Other address: Country | {{Client.OtherCountry}} |
| Phone | {{Client.Phone}} |
| Company: Fax | {{Client.Fax}} |
| Website | {{Client.Www}} |
| Notes | {{Client.Notes}} |
| Score | {{Client.Score}} |
| Account manager: User ID | {{Client.UserId}} |
| Account manager: Name | {{Client.UserName}} |
| Account manager: Email | {{Client.UserEmail}} |
| Account manager: Phone | {{Client.UserPhone}} |
| Account manager: Mobile phone | {{Client.UserCellPhone}} |
| Account manager: Role | {{Client.UserRole}} |
| Account manager: Title | {{Client.UserTitle}} |
| Duns number | {{Client.DunsNo}} |
| Created by: User ID | {{Client.RegById}} |
| Added by: User name | {{Client.RegByName}} |
| Created by: Email | {{Client.RegByEmail}} |
| active | {{Client.Active}} |
| Assigned user: ID | {{Client.AssignedUserId}} |
| Assigned user: Name | {{Client.AssignedUserName}} |
| Assigned user: Email | {{Client.AssignedUserEmail}} |
| Assigned user: Phone | {{Client.AssignedUserPhone}} |
| Assigned user: Role | {{Client.AssignedUserRole}} |
| Assigned user: Title | {{Client.AssignedUserTitle}} |
| Price list (code) | {{Client.PriceList}} |
| Company: Organisation number | {{Client.OrgNo}} |
| Created * | {{Client.RegistrationDate}} |
| Industry: SNI * | {{Client.SniCodeValue}} |
| Industry: SIC * | {{Client.SicCodeValue}} |
| Industry: NAICS * | {{Client.NaicsCodeValue}} |
| Industry (UK SIC) * | {{Client.UKSicCodeValue}} |
| Industry (NACE) * | {{Client.NaceCodeValue}} |
| Status * | {{Client.StatusValue}} |
| Corporate form * | {{Client.CompanyFormValue}} |
| Credit rating * | {{Client.CreditRatingValue}} |
| Industry: SNI code * | {{Client.SniCode}} |
| Industry: NACE * | {{Client.NaceCode}} |
| Industry: SIC code * | {{Client.SicCode}} |
| Industry: NAICS code * | {{Client.NaicsCode}} |
| Status (code) * | {{Client.Status}} |
| Corporate form (code) * | {{Client.CompanyForm}} |
| Credit rating (code) * | {{Client.CreditRating}} |
| Turnover * | {{Client.Turnover}} |
| Profit * | {{Client.Profit}} |
| Number of employees * | {{Client.NoEmployees}} |
| Facebook * | {{Client.Facebook}} |
| Twitter * | {{Client.Twitter}} |
| LinkedIn * | {{Client.LinkedIn}} |
* Shown when that field is active in your account.
General
| Name in the list | Tag |
|---|---|
| Today | {{General.Today}} |
| Clear field | {{General.ClearField}} |
| Current year | {{General.CurrentYear}} |
| Logged in user: ID | {{General.CurrentUserId}} |
| Logged in user: Role ID | {{General.CurrentUserRoleId}} |
| Logged in user: Name | {{General.CurrentUserName}} |
| Logged in user: Email | {{General.CurrentUserEmail}} |
| Logged in user: Phone | {{General.CurrentUserPhone}} |
| Logged in user: Mobile phone | {{General.CurrentUserCellPhone}} |
| Logged in user: Title | {{General.CurrentUserTitle}} |
| Logged in user: Default email signature | {{General.CurrentUserMailSignature}} |
| Company name | {{General.CompanyName}} |
| Company phone | {{General.CompanyPhone}} |
| Company address | {{General.CompanyAddress}} |
| Company: Postcode | {{General.CompanyZipCode}} |
| Company: City | {{General.CompanyCity}} |
| Company country | {{General.CompanyCountry}} |
| Company email disclaimer | {{General.CompanyDisclaimer}} |
| Default senders email | {{General.CompanyEmail}} |
| Company sender | {{General.CompanySender}} |
Triggers on tickets
Triggers on Ticket can only use Send webhook, for example to post new tickets to a chat channel that accepts incoming webhooks. The Title criterion compares the whole title, so a trigger can't react to a word inside the subject.
To email someone about new tickets, or to set ticket type, priority and assignee automatically, use ticket rules.