IBM BPM, V8.0.1, All platforms > Create processes in IBM Process Designer > Create user interfaces for business processes > Developing reusable Coach Views

Adding custom AMD modules

You can use custom AMD (Asynchronous Module Definition) modules in your Coach Views.

IBM BPM includes the Dojo 1.7.3 AMD loader. With this loader, you can package custom AMD modules and then register a dependency on those modules in your Coach View. Registering a module involves assigning an alias for the module because the Coach View accesses the module by using its alias.


Procedure

  1. Prepare the AMD package:

    1. Package your AMD modules in a .zip file such as myPackage.zip.
    2. Upload that .zip file as a managed web file.

    3. Create a JavaScript file to define the package map for your AMD modules.

      For example, create the myPackageMap.js file and add the following package map code for AMD modules that are called myModule and myOtherModule:

      require({
      	packages: [
      		{name: ' myModule', location: com_ibm_bpm_coach.getManagedAssetUrl(' myPackage.zip', 
      			com_ibm_bpm_coach.assetType_WEB, ' PROJECT') + " /path/to/myModule"} 		{name: ' myModule', location: com_ibm_bpm_coach.getManagedAssetUrl(' myPackage.zip', 
      			com_ibm_bpm_coach.assetType_WEB, ' PROJECT') + " /path/to/myOtherModule" } 	]});

      If the module is in the current process application or toolkit, do not include the PROJECT parameter. The PROJECT parameter contains the acronym or short name of the process application or toolkit that contains the .zip file.

      If the class for the AMD module is at the root of the managed web file, do not include the /path/to/myModule parameter. The /path/to/myModule is the path in the .zip file to the AMD module class.

    4. On the Behavior page of your Coach View, add the JavaScript file as an included script.
  2. Register each AMD module in your Coach View:

    1. On the Behavior page of the Coach View, select AMD dependencies.

    2. Click Add and then specify the following information:

      • In the Module ID column, declare the dependency on the AMD module by using a path like myPackage/path/to/myModule.

      • In the Alias column, type the alias that you use in the code to refer to the module.

  3. In your Coach View code, use the alias to access the functions of the AMD module.

Developing reusable Coach Views


Related tasks:
Developing reusable Coach Views
Example: creating a Dojo button control