Run from external script

Posted by @davenicholls, Last update almost 6 years ago

Runs an action based on a JavaScript file stored in iCloud.

The action must be duplicated and renamed before use. This is because on first use it prompts for the script file to be run and then saves it for future use in a credential named based on the action name.

Subsequent uses load the script name from the credential automatically.

Note: the filename is used as is. Simple filenames (e.g. test.js) are assumed to be in the Drafts root iCloud folder. If the file is in a subfolder give the complete path (e.g. /Scripts/test.js)


  • script

    if ( != "Run from external script") {
    	var credential = Credential.create("Script action: ","Script name credential");
    	credential.addTextField("scriptFile", "Script File Name");
    	var result = credential.authorize();
    	scriptFile = credential.getValue("scriptFile");
    	var db = FileManager.createCloud();
    	var script =;
    	if (script) {
    	else {
       	alert("Couldn't load script");;
    else {
    	alert("Please copy and rename this script before use");;


  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.