Creating Custom Actions with Node.js
Use the Node Code block to create custom actions in your webMethods Integration account. In this section, know how the custom action works, and how to create it with the help of an example.
While webMethods Integration provides 1000+ actions for your workflows, you can also create your own custom action using the Node.js action. webMethods Integration also provides an action builder that lets you insert custom code and create an action that looks and works exactly the way other actions do.
Overview
Custom actions are saved under the Custom tab in the connectors page. To create a new custom action by using the Node.js block, go to the Custom tab, and click the + icon that is located next to the Node.js action.
The Node.js block appears where you can see the basic code structure that is needed to create the custom action.
-
Label: Provide a suitable name for the custom action you want to create. -
Code: Add the relevant logic in the provided code structure. The code that you add must be in Node.js and according to the code structure and conventions that are specified in the later part of this document. Next, click Compile. If there are any errors in the code, they are highlighted in the console.When your code is compiled successfully, you can see the configuration form for the custom action. If you want to make further modifications to this form, click the Previous option, make relevant changes to your code, and compile it again. After you have created the custom action as per your requirements, click Save.
The custom action is created and added to the list of custom actions under the Custom tab. You can now add this custom action to any workflow and configure it like any other action.
Code structure components
These conventions to add the form data are classified into 3 main blocks of program code.
-
this.input: This block includes the definition of form input fields. -
this.output: This block includes the definition of the output parameters that your action returns. -
this.execute: This block includes the program logic that runs inside the webMethods Integration engine.