Xtending Nintex Workflow Cloud with Azure Functions · C#>Cloud>Azure Functions • “Azure...

37
Xtending Nintex Workflow Cloud with Azure Functions

Transcript of Xtending Nintex Workflow Cloud with Azure Functions · C#>Cloud>Azure Functions • “Azure...

Xtending Nintex Workflow Cloud with Azure Functions

Mike OryszakManaging DirectorB&R BUSINESS SOLUTIONS, LLC

Tom CastigliaSolution ArchitectDOCFLUIX, LLC

About Tom Castiglia

SharePoint/Office 365 Consultant

President of the San Diego SharePoint User Groupmeetup.com/sanspug

Nintex vTE (virtual Technical Evangelist)

Speaker at various SharePoint Saturday conferences

@TomCastiglia

About Mike Oryszak

SharePoint/Office 365/Azure Consultant

President of the Triangle SharePoint User Groupmeetup.com/trispug

Speaker at various conferences and events

@next_connect

• Azure Functions• Open API (Swagger)

• Solution Overview• Azure Portal Demo• Function Review• Define Xtension

in NWC• Define Connection

in NWC• Use the Action

• Solution Overview• NWC Integration• Define Xtension

in NWC• Define Connection

in NWC• Use the Action

• More Use Cases• Q&A• References

Agenda

Overview Logging Compliance Activities to Azure

Retrieve GSA Per Diem Rates

Next Steps

Overview

8

Azure Functions—overview

Build apps faster with a serverless architectureAccelerate your development with an event-driven, serverless compute experience. Scale on demand and pay only for the resources you consume.

Manage your apps instead of infrastructureDon’t worry about provisioning and maintaining servers, especially when your workload grows. Functions provides a fully managed compute platform with high reliability and security and they scale on demand.

9

Azure Functions—overview

Develop your way

Code in Visual Studio 2017 15.3 or later (Still in preview)Install “Azure Development” workloadIncludes tooling to create Azure Function projects and classes locally and publishIncludes Azure CLI (Command Line Interface) which allow you to run and debug your functional locally

Languages: JavaScript, C#, and F#, and scripting options such as Python, PHP, Bash, Batch, and PowerShell

Code directly in Azure portal

OR

10

OpenAPI (Swagger)—overview

When you publish an Azure Function, it creates a REST endpoint for your function

OpenAPI allows you to configure the details of your endpoint

URLHTTP Methods (GET, POST, PUT, etc.)InputsOutputs

11

OpenAPI (Swagger)—overview

It’s a JSON file

Configured using “YAML”… “a human friendly data serialization standard for all programming languages”“YAML Ain’t Markup Language”

Import your function to NWC as a custom connector/action

Help available at https://swagger.io

Scenario 1: Logging compliance activities to Azure

Logging compliance activities to Azure

Imagine many workflows throughout the org including activities within the scope of internal or external audit

Need to log compliance activities centrally to support reporting

• Process/workflow name• Category• Date• Message

Solution overview • REST Call to Function AppNintex

Workflow

• Triggered with REST Call• Parses request and writes to Queue

Function App

Storage Queue

• Triggered by Queue message• Writes to Cosmos DB

Function App

Cosmos DB

Developed in the browser using C#

Leverages • Function App for

processing• Storage Queue for

reliable delivery• Cosmos DB for storage

15

Demo!

Scenario 2: Retrieve GSA per diem rates

17

GSA Per Diem API

Common workflow use cases are travel authorization requests and expense reports, where employees travel and incur expenses for meals and hotels

The GSA publishes official “Per Diems” that dictate the maximum amounts that are may be expensed for hotels and meals • The Per Diem amounts are updated each year• Each region has its own per diems (e.g., hotels in NYC cost more than in Des Moines)• Per Diems also vary by month, based on peak travel seasons

Public web site: • https://www.gsa.gov/travel/plan-book/per-diem-rates

Per Diem API

https://inventory.data.gov/api/action/datastore_search?resource_id=8ea44bc4-22ba-4386-b84c-1494ab28964b&filters={"FiscalYear":"2017","Zip":“92131"}

https://inventory.data.gov/api/action/datastore_search?resource_id=8ea44bc4-22ba-4386-b84c-1494ab28964b&filters={"FiscalYear":"2017","County":"Worcester"}

Fiscal year and zip

Fiscal year and county

REST API References:https://www.gsa.gov/technology/government-it-initiatives/digital-strategy/per-diem-apis/api-for-per-diem-rates

Sample response (abbreviated)

• The “Records” element is nested within a bunch of stuff that can be ignored

• The element for each month represents the hotel Per Diem for that month

• The “Meals” element represents the Per Diem allowed for meals for the year

Using Visual Studio• New Project>Visual

C#>Cloud>Azure Functions

• “Azure Functions” maps to a “Function App”, which can contain 1–N individual functions

• Right-click the project andselect publish

• Create new Azure Function App, then click publish

Function App

• Log into Azure Portal to review new Function App

• Notice it does not contain any functions yet

• In Visual Studio, right-click the project and click Add > New Azure Function

• Name the function and click Add

• Select function type as Http Trigger and click OK

Function App

Republish from VS2017 and notice your functional app now contains the new function

23

Accept Zipcodeand Tripdate in

JSON as input (in body of request)

Validate inputs

Format REST call to GSA API

Format JSON response with GSA Per Diem amounts (hotel and meals)

GSA Per Diem wrapper

24

JSON formatting

Input Output

Classes for GSA Per Diem JSON

DeserializeInput JSON Incoming JSON

Call to GSA REST API

Output JSON/HTTP response

JSON response

Configure HTTP Methods

Configure API definition

Nintex Workflow Cloud

Nintex Workflow Cloud

Configure GSA Per Diem action in NWC

Next steps

Additional use cases

Integrating with additional LOB systems

Q&A

From the xchange mobile app, select “Survey” from the sessions that you attend

Complete the short evaluation

Click “Submit”