Skip to main content

Extending Nintex Workflow Cloud Further with Azure Functions

Nintex Workflow cloud allows workflow developers to build robust workflows using a number of different actions in the Nintex Workflow Cloud designer. However, sometimes an action that needs to be completed is not available out-of-the-box. A workflow developer could look for a web service that could accomplish the action requirement, but what if you wanted more control of the action and not be beholden to the availability of the web service? Azure functions to the rescue!

 

In this example, I need to be able to URL encode/decode a string value so that the QR Code Generator Connector that  built can be used within my workflow. Let's head over to our Azure portal and create a new Azure Function!

 

Azure Functions Example: Oversimplified

One of the great features of Azure Functions is that you can choose the coding language of your choice to build a function, but in this example I will be using Node.js. There are two parameters I want to collect:

  • Method: Decode or Encode
  • Text: Value to decode or encode

 

Based on the values entered, the function will provide you a string value that has either been encoded or decoded, and that value will be the response back to the workflow. Below is the code to achieve this requirement:

 

 

module.exports = function (context, req) { const getVal = (method, text) => { return method === 'Decode' ? decodeURI(text) : encodeURI(text) }; let m = req.body.method; let t = req.body.text; res = getVal(m, t); context.done(null, res); };

 

 

Next, we will take advantage of another great feature of Nintex Workflow Cloud.

 

Custom Connectors: The Magic on Top of the Magic

Nintex Workflow Cloud allows you to add custom connectors from third-party RESTful web services utilizing the OpenAPI standard. You will be able to build the API definition of the service, if one does not already exist, and import that API definition into your Nintex Workflow Cloud tenant to be used as if it is a native action in Nintex Workflow Cloud.

 

Luckily for us, we built this service ourselves, so it shouldn't be hard to write the API definition. The definition was built to have a dynamic subdomain for the host URL, so you may point it to your Azure tenant functions resource. Also to note, although this API definition is calling for Basic Authentication, it is only added as a way to dynamically enter your subdomain. So feel free to use ' ' blank spaces for username and password. Although, if you did need to include some sort of authentication to make a call to the function, that is possible too.

 

To make easy, here is what the definition would look like:

 

 

{ "swagger": "2.0", "info": { "description": "Because sometimes you need to encode some things", "version": "1.0.0", "title": "Encode or Decode URI" }, "host": "example.azurewebsites.net", "x-ntx-host": "{{subdomain}}.azurewebsites.net", "basePath": "/api", "schemes": p "https" ], "security": { "basic": "] } ], "securityDefinitions": { "basic": { "type": "basic", "x-ntx-connection-properties": { "type": "object", "properties": { "subdomain": { "type": "string", "title": "Subdomain", "description": "Your Azure tenant name" } }, "required": "subdomain" ] } } }, "paths": { "/encodeDecode": { "post": { "x-ntx-summary": "Encode or Decode a URI", "description": "", "operationId": "encodeURI", "consumes": I "application/json" ], "produces": "application/json" ], "parameters": , { "in": "body", "name": "body", "description": "", "required": true, "schema": { "$ref": "#/definitions/req" } } ], "responses": { "200": { "description": "Hooray!", "schema": { "type": "string" } }, "405": { "description": "Invalid input" } } } } }, "definitions": { "req": { "type": "object", "properties": { "text": { "type": "string" }, "method": { "type": "string", "enum": t "Encode", "Decode" ] } } } } }

 

 

To ensure that the user does not enter in a method other than 'Encode' or 'Decode', you'll notice that the object definition uses the enum property so we can provide a dropdown select in the action configuration. 

 

To make this even easier, here is a link to the Encode/Decode URI connector in the Nintex Process Accelerator Gallery. 

 

Speaking of the Nintex Process Accelerator Gallery, if you would like to see what other custom connectors, process map templates, workflow templates, and Nintex RPA templates are available to get you ahead of the process game, I highly recommend heading over to the Nintex Process Accelerator Gallery and browsing the available templates and tools!

 

Once you have downloaded the custom connector from the gallery, you will then head over to your Nintex Workflow Cloud tenant and click on Xtensions on the left-hand pane to import your custom connector. Follow the prompts (don't forget the ' ' for username and password in this example!) and now you will have the ability to encode or decode string values in your Nintex Workflow tenant.

 

Be the first to reply!

Reply