SpartivoDocs
Open app
Get started
OverviewQuickstartAuthenticationRequests and errors
API reference
RecordsModules and fieldsFilesMessagingDocuments and e-signatureFunctionsWebhooks
Spartivo Script
IntroductionLanguage guideCRM and actionsBuilt-in functionsExamples
Spartivo Script

Spartivo Script

Spartivo Script is a small language for writing your own logic inside the CRM. It reads like plain steps, has no setup, and runs on our servers with the CRM one function call away.

A first function
if (record.amount > 100000) {
  crm.updateRecord(record.id, {"priority": "high"});
  notify({"user": record.ownerId, "title": "Large deal: " + record.name, "record": record.id});
}
return "checked";

Where functions run

TriggerHow to set it uprecord is
Workflow ruleSetup → Workflow rules → action Run functionthe record that triggered the rule
Custom buttonSetup → Custom buttons → action Run functionthe record the button is on
ScheduleIn the function's settings: every hour, day or weeknull
Another functionrun("api_name", {…})the caller's record
Your own systemRun a function through the APIthe recordId you send, or null

Write one

  1. Open Setup → Developer space → Functions and choose New function.
  2. Write the code. The editor suggests functions and your module's fields as you type, and underlines mistakes before you run anything.
  3. Pick a record under Test and press Run to see the result and the log.
  4. Save, then attach the function to a workflow rule, a button or a schedule.
A test run is real. Records it changes and messages it sends are not undone, so test with a record you do not mind changing.

What is always available

record
The record the function is running on, or null when there is none. Fields are read by their API name. Also has id, name, module, ownerId, owner, tags, createdAt and updatedAt.
record.email
user
The person who triggered the run: id, name, email and role. Null for scheduled runs.
user.email
input
A map of the arguments passed to the function. Each declared parameter is also available as its own variable.
input.days
Language guideValues, conditions, loops and error handling.CRM and actionsRead and change records, send messages, call other systems.Built-in functionsText, lists, maps, dates and numbers.ExamplesComplete functions you can copy and adapt.
Previous← WebhooksNextLanguage guide →
On this page
Where functions runWrite oneWhat is always available