Configure Custom JavaScript Functions

Create custom JavaScript functions to use as Functions in Flow_Studio.

To create a JavaScript function:

  1. Click the heading titled JavaScript function on the Administration home page.
  2. Click Create new JavaScript function.



  3. Fill in the configuration form:

    • Enter a function name.
    • Enter a function description.
    • Enter the limit of execution time in milliseconds.
    • Enter the limit of execution memory in megabytes. 
    • Enter an input argument name and select a data type.
      • Add additional input arguments. (Optional)
    • Enter an output argument and select a data type.
      • Add additional output arguments. (Optional)
    • Enter the JavaScript function.

      Known Issue

      Single quotes around multi-line strings do not produce the expected result.

      Below is a work around solution for this issue using an XML function.

      var jsonObj = {"Flag":Flag, "Count":Count};
      var jsonOutput = JSON.stringify(jsonObj);
      var xmlOutput = eval("OBJtoXML("+jsonOutput+");")
      addOutput("XMLOut", xmlOutput);
      function OBJtoXML(obj) {
        var xml = '';
        for (var prop in obj) {
          xml += obj[prop] instanceof Array ? '' : "<" + prop + ">";
          if (obj[prop] instanceof Array) {
            for (var array in obj[prop]) {
              xml += "<" + prop + ">";
              xml += OBJtoXML(new Object(obj[prop][array]));
              xml += "</" + prop + ">";
            }
          } else if (typeof obj[prop] == "object") {
            xml += OBJtoXML(new Object(obj[prop]));
          } else {
            xml += obj[prop];
          }
          xml += obj[prop] instanceof Array ? '' : "</" + prop + ">";
        }
        var xml = xml.replace(/<\/?[0-9]{1,}>/g, '');
        return xml
      }



  4. Click OK.