OverviewA Custom Script is a sequence of one or more Actions that you give a name to. Once you create a Custom Script, you can use it throughout your app.
Custom Scripts are useful when you have a sequence of actions that you want to have triggered from several different places in your app.
When to use Custom Scripts
For example, if you created a payment sequence. You could make the various Actions in a Custom Scripts which you can call each time a payment is required.
Creating Custom ScriptsTo create a custom script, take the following steps:
- To create a Custom Script, select 'Custom Scripts' in the left hand side navigation panel.
2. Select the Custom Script Menu, then ' New Custom Script'
3. Give your Custom Script a name
3. Select the Pencil Icon to Add Actions
You can write a Custom Script using:
In this example we select EachScape Actions: Action Script
This brings up the Action Editor, use the to add Actions to the Script
Using Custom ScriptsThere are two ways to use Custom Scripts
- In an Event, you can use the Action "Run Script" to call your script. To do this, add the "Run Script" Action to the desired event, and select your Custom Script from the Action's "Custom Script" field.
- In an HTML Block, you can create a link that will run the custom script. This is done using the "script" protocol:
<a href="script:myCustomScript">Run Script</a>The above link HTML would run the Script called "myCustomScript" when "Run Script" is clicked. You can also set Variables when you call your script, and use variables you created within an HTML Block within EachScape
<a href="script:myCustomScript?var1=apple&var2=42">Script with Variables</a>The above link would run "myCustomScript" and also set a Variable called "var1" with a value of "apple" and a Variable called "var2" with a value of "42" that will be available to use throughout your app.
- Use variables you created within an HTML Block within EachScape