Welcome, Guest Login

Support Center

Custom Scripts

Last Updated: Oct 16, 2017 12:29PM EDT

Custom Script

Overview

A 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.


When to use Custom Scripts

Custom Scripts are useful when you have a sequence of actions that you want to have triggered from several different places in your app.  
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 Scripts

To create a custom script, take the following steps:
  1. 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:

1. EachScape ActionsOR
OR
2. JavaScript


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 Scripts

There 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. 

    Note: if you are using Javascript in an HTML Block, using the window.location= Javascript syntax to run a Custom Script may not work on some browsers.

    Learn More

    Use variables you created within an HTML Block within EachScape
    - JavaScript Function Call

Help us improve! Rate this article:

Yes I found this article helpful

Ask a Question   

support@eachscape.com
http://assets0.desk.com/
false
eachscape
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete