Where scripts run
A script that only runs when you press Run is a notebook. The useful scripts start by themselves. This part covers every way that can happen, what each one gives the script to work with, and what limits and permissions apply.
The ways a script starts
Section titled “The ways a script starts”| Start | Set up in | The script gets |
|---|---|---|
| An event | Settings > MaSH > Events | mash.event for the file, person or message involved |
| A schedule | Settings > MaSH > Schedule | a list of files in mash.event.files, or none |
| A webhook | Settings > MaSH > Webhooks | the web request, in mash.event.input |
| The file action menu | Settings > MaSH > Users & groups | the files someone selected |
| A form, a signing envelope or a review | the form, the envelope or the review rule | the answers, the envelope or the decision |
| Grace | a chat with Grace | a script she drafts for you, saved when you confirm |
| Another script | mash.scripts | whatever input the caller passes |
| By hand | the editor’s Run button | no event; you can pick a test file and a test user, and turn on Virtual mode to use mock files and I/O |
Every saved run, except one you start by hand, leaves a line on the run log.
What every run has in common
Section titled “What every run has in common”- It is one run, start to finish. Variables don’t survive from one run to the next. Keep anything you need later in a custom field, a file or
mash.store. - It has a time and memory limit. The numbers are on the Limits page. A queued run gets 60 seconds on both Foldr Cloud and an appliance.
- It runs as a person, and that person’s rights apply. See Who a script runs as.
- It needs the MaSH feature. Webhooks and the file action menu check for it on every call. A tenant without it can’t use them.
- Errors don’t always stop it. A failed call is recorded and the script carries on, unless you handle it. See Errors and the run log.
Where to start
Section titled “Where to start”If you want a script to run when something happens to a file, read Events. If you want it to run at a set time, read Schedules. If another system needs to call Foldr, read Webhooks. Foldr Cloud and appliances lists what differs between the two.
Finished scripts for common jobs are in the How-to guides.