3. Mike Oryszak
Managing Director
B&R BUSINESS SOLUTIONS, LLC
Xtending Nintex Workflow Cloud w/ Azure Functions
Tom Castiglia
Solution Architect
DOCFLUIX, LLC
4. About Tom Castiglia
• SharePoint / Office 365 Consultant
• President of the San Diego SharePoint User Group
• Meetup.com/sanspug & meetup.com/socalo365
• Nintex vTE (virtual Technical Evangelist)
• Speaker at various SharePoint Saturday conferences
@TomCastiglia
5. About Mike Oryszak
• SharePoint / Office 365 / Azure Consultant
• President of the Triangle SharePoint User Group
• meetup.com/trispug
• Speaker at various conferences and events
@next_connect
6. • 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
8. 9
Azure Functions - Overview
Build apps faster with a serverless architecture
Accelerate 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 infrastructure
Don’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. 10
Azure Functions - Overview
Develop your way
• Languages: JavaScript, C#, and F#, and scripting options such as Python, PHP,
Bash, Batch, and PowerShell.
• Code directly in Azure portal
-- OR --
• Code in Visual Studio 2017 15.3 or later (Still in preview)
• Install “Azure Development” workload
• Includes tooling to create Azure Function projects and classes locally and publish
• Includes Azure CLI (Command Line Interface) which allow you to run and debug your
functional locally.
10. 11
Open API (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
• URL
• HTTP Methods (GET, POST, PUT, etc.)
• Inputs
• Outputs
11. 12
Open API (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
13. 14
Logging Compliance Activities to Azure
• Scenario:
• 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
14. • REST Call to
Function App
Nintex
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
Solution Overview
• Developed in the browser using C#
• Leverages
• Function App for processing
• Storage Queue for reliable delivery
• Cosmos DB for storage
17. 18
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 “PerDiems” that dictate the
maximum amounts that are may be expensed for Hotels
and Meals.
• The PerDiem amounts are updated each year.
• Each region has its own per diems (e.g. Hotels in NYC cost more than in Des
Moine)
• PerDiems also vary by month, based on peak travel seasons
• Public web site:
18. 19
Per Diem API
REST API References:
https://www.gsa.gov/technology/government-it-
initiatives/digital-strategy/per-diem-apis/api-for-per-
diem-rates
• Fiscal Year and Zip
https://inventory.data.gov/api/action/datastore_search?resource_id=8ea44bc4-22ba-4386-
b84c-1494ab28964b&filters={"FiscalYear":"2017","Zip":“92131"}
• Fiscal Year and County
https://inventory.data.gov/api/action/datastore_search?resource_id=8ea44bc4-22ba-4386-
b84c-1494ab28964b&filters={"FiscalYear":"2017","County":"Worcester"}
19. 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
20. 21
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 and
select Publish
• Create new Azure
Function App.
Then click
Publish.
21. 22
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
22. 23
Sample “Hello, World” Function …Republish from
VS2017 and
notice your
functional app
now contains the
new function
23. 24
GSA Per Diem Wrapper
Accept
Zipcode and
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)
Fair warning … this is the most complex part of the process. Troubleshooting is tricky. We could easily spend an hour on this alone, but we’ll have to skim over this part later.
Visual Studio provides excellent support for serializing / deserializing between JSON. Also can auto-generate new classes from existing JSON, using the Paste Special menu under Edit.
The CreateResponse method automatically serializes the PerDiemOutput class into JSON.
If we enable additional methods that aren’t needed the API definition (next step) will be more complex, so its best to limit to just POST.
Select the Function App > Platform Features > API Definition
Click Generate API Definition template
Edit the API Definition
Save
Click Xtensions then the Plus (+) sign
Copy/Paste the API Definition Url including the key (from Azure portal). Then click Next.
Accept default settings on the Security page. Then click Next.
Specify a friendly Name and Description for the connector. Select an icon or upload a custom icon. Then click Save.
Click Connections > Add New
Select the DocFluix Demo App from the Connector list, then click Connect
Give the new connection a friendly name (e.g. DocFluix Demo) and paste in the API Key, the click Connect
Verify the connection is created successfully, then click Ok