Using Libraries to Manage Functions for Integrations

Extension libraries provide a means to register and organize JavaScript for use in integrations. Library functions are automatically available for you to drag from the Actions palette to your orchestration integrations.

You can use the library functionality to:

  • Register a new API library

  • See a list of all registered API libraries

  • View the details of an API library

  • Edit the details of an API library

  • Determine which integrations are using library functions

  • Delete a registered API library

  • Download a library source file to your desktop

  • Add library functions to the orchestration Actions palette.

Registering an API Library

In order for custom function calls to appear in the integration Actions palette, you must register the libraries that contain them.

  1. Open the Libraries page. In the left Designer navigation bar, click the Libraries item or click the Libraries icon on the Home page.
  2. Click the Register button in the title bar.
  3. In the Register Library dialog box, click Browse to select a JavaScript (.js) library file.
  4. Specify a name, identifier, version number and optional description.

Example 2-1 Code Format

Function return parameters must be named like the example below. You should configure the return parameter type in the metadata UI only if the return parameters are named.

Consider the following code:

function add ( param1, param2 )
 {    return param1 + param2;
}

Although the above syntax is valid, the return parameter will not appear in the metadata UI for configuration. For that to happen, the code must return a named parameter. Create a new variable and assign return values before the variable is returned. For example, like this:

function add ( param1, param2 ) {
   var retValue = param1 + param2;
   return retValue;
}

Example 2-2 Function Within Another Function

Functions defined within another function do not appear in the metadata UI for configuration.

 Consider the following code:

numeric.parseDate = function parseDate(d) {
    function foo(d) {
        if(typeof d === 'string') { return Date.parse(d.replace(/-/g,'/'));} 
     if(!(d instanceof Array)) { throw new Error("parseDate: parameter must be arrays of strings"); }
     var ret = [],k;
     for(k=0;k<d.length;k++) { ret[k] = foo(d[k]); }
        return ret;
    }
     var retVal = foo(d);
     return retVal;
   }

In this case foo is defined within parseDate. Thus, foo does not appear in the metadata UI for configuration.

Viewing Library Details

View details about a library without changing any information.

  1. Open the Libraries page. In the left Designer navigation bar, click the Libraries item or click the Libraries icon on the Home page.
  2. Select View from the Menu icon menu at the end of the row on which the library is listed.

    The files and their constituent functions are displayed. You can expand and contract the list of functions and you can search and filter the list as well. To view information about a function, click on the function. To view the source code, click on the file name and download the code to your desktop. You can also click on the file name to annotate the entry with your comments.

    You can use the Menu icon menu on this page to view primary information about the library and to export XML metadata to your desktop.

  3. When you are done, click Close on the title bar.

Editing Library Details

Edit details about a library.

  1. Open the Libraries page. In the left Designer navigation bar, click the Libraries item or click the Libraries icon on the Home page.
  2. Either click on the library name or select Edit from the Menu icon menu at the end of the row on which the library is listed.

    The files contained in the library and their constituent functions are displayed. You can expand and contract the list of functions, and you can search and filter the list. To edit information about a function, click on the function. To view the source code, click on the file name and download the code to your desktop. You can also click on the file name to annotate the entry with your comments.

    If the function is in use in an integration, you are warned about it and the function is presented in view-only mode.

    If the function is available for editing, you are presented with the following options:

    • You can set the classification type to be Orchestration, enabling the function to be used in orchestrations.

    • You can set the data types of the function’s input and output values, defining them as Boolean, Number or String. You can also add a description.

    You can use the Menu icon menu on this page to:

    • View primary information about the library

    • Export XML metadata to your desktop

    • Delete the library

    • Save your changes (the same as clicking Save on the title bar)

  3. When you are done, click Save and Close on the title bar.

Determining Which Integrations Use a Library Function

You can determine which integrations are using functions in a given library.

  1. Open the Libraries page. In the left Designer navigation bar, click the Libraries item or click the Libraries icon on the Home page.
  2. Click the number in Used by Integrations label in the line beneath the library’s name. The number indicates the number of integrations that use functions in the library.
    When you click the number, the Library Is In Use popup is invoked. It lists the names of the integrations that use the library’s functions. This popup is also invoked if you attempt to edit or delete a library that is currently in use.

Deleting a Library

Delete a library.

  1. Open the Libraries page. In the left Designer navigation bar, click the Libraries item or click the Libraries icon on the Home page.
  2. Select Delete from the Menu icon menu at the end of the row on which the library is listed.
    If any of the library’s functions are being used by an integration, the Library Is In Use popup is invoked and you are prevented from deleting the library. You must remove the functions from the integration before you delete it.

Downloading a Library File

You can download a library to a source file (.jar or .js) on your desktop.

  1. Open the Libraries page. In the left Designer navigation bar click the Libraries item or click the Libraries icon on the Home page.
  2. Select Download Library File from the Menu icon menu at the end of the row on which the library is listed.
    A browser popup is invoked to save the file to your desktop.

Using Library Functions in Orchestrations

Library functions are available from the orchestration Actions palette from where you can incorporate them into your orchestrations.

After you register and edit your library functions, they are available from the orchestration Actions palette. You can drag them from the Actions palette to your orchestrations. See Adding a Function Call Action.