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
| Trigger | How to set it up | record is |
|---|---|---|
| Workflow rule | Setup → Workflow rules → action Run function | the record that triggered the rule |
| Custom button | Setup → Custom buttons → action Run function | the record the button is on |
| Schedule | In the function's settings: every hour, day or week | null |
| Another function | run("api_name", {…}) | the caller's record |
| Your own system | Run a function through the API | the recordId you send, or null |
Write one
- Open Setup → Developer space → Functions and choose New function.
- Write the code. The editor suggests functions and your module's fields as you type, and underlines mistakes before you run anything.
- Pick a record under Test and press Run to see the result and the log.
- 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
recordThe 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.emailuserThe person who triggered the run: id, name, email and role. Null for scheduled runs.
user.emailinputA map of the arguments passed to the function. Each declared parameter is also available as its own variable.
input.days