Nintex Document Generation

I recently was asked a question: how can I use the signature from the Nintex Mobile inside a document being generated by the Generate Document action? Unfortunately this is not yet feasible only using Nintex products. This is because Nintex Workflow for Office 365 is not handling correctly the binary data (it loses null bits) so what I proposed was to use Microsoft Flow.

The process

  1. User sings a form in Nintex Mobile.
  2. The signature along with the form is saved in a SharePoint list.
  3. Then the Nintex workflow on item’s creation is triggered.
  4. It builds a JSON, that is a request body, then calls Microsoft Flow, passing:
    1. form’s title and
    2. base64 encoded signature from a multi-line text field.
  5. Flow receives the call, starts and uploads signature to the images library, converting it from base64 to binary.
  6. In resposne Flow sends the URL to the created file.
  7. Nintex receives the response and attempts to generate a document, having an image defined, that is the signature, having a variable set as a path (that is returned by Flow).
  8. Finally it generates a PDF with the signature inside.

Implementation

Microsoft Flow

Its purpose is simple – get base64 encoded string and convert it into binary, then upload to a specified document’s library. It is being invoked by a “Web Request” message, that should contain a valid JSON string, containing title of a form (it is using it to set file’s name) and base64 encoded string.

{
  "Title": "Form's title or other text variable",
  "Signature": "The base64 encoded signature image"
}

 

After that it immediately calls SharePoint (using “Create File” action) and uploads the file, using the expression “Base64ToBinary”:

base64ToString(triggerBody()?['Signature'])

Create File in SharePoint in Microsoft Flow

After that it send back in “Response” action the uploaded file path:

Response action Microsoft Flow

Nintex Workflow

Is being triggered once a new item is created – user sends the signed form. Workflow purpose is to build a JSON that is a request body, and that is in a correct format – the one that Microsoft Flow workflow is expecting.

Then it calls the Flow, using the “Web Request” action:

Nintex Web Request action configuration

And stores the “Response Content” in a text variable.

Then it builds an absolute path to the uploaded signature image, by joining workflow context’s current site URL with the text received after Web Request call – the site relative path of the uploaded file.

Next it generates the document.using the Document Generation action.

The results

The working proof of concept:

Working PoC

 

You can find attached exported Nintex Workflow and Flow files.

[wpdm_package id=’1019′]

[wpdm_package id=’1018′]