• vadim@workflowexcellence.com
  • Utah, United States

Nintex Forms for Office 365 – Dynamically Generated Hyperlinks

Today, I had a request on how to have links to documents in a Nintex Form (O365), but specifically in a Task form that was created from Nintex Workflow for Office 365.  It’s an interesting question, since at this stage, we don’t have access to Nintex Workflow variables in the Nintex Form.

I did figure out a workflow and you can see it in action in the video below.  I’ll also talk about it under the video and the workflow is downloadable in the Downloads section below.

This process requires both Nintex Workflow and Forms for Office 365.  The form in this example is just for the task action (Assign a Task).  I think going through all the bits here is just doubling up as I’ve described what the steps are in the video.

But, here is the JavaScript that is required in the form to get the information so that you can build up the Hyperlinks on the form.

NWF.FormFiller.Events.RegisterAfterReady(function () 
{
 var sRichText = '';
 var myObj = NWF$('.cssUrlLinks .nf-filler-control-border .nf-filler-control-inner input');

 var urls = myObj.val().split(';');
 for (var index in urls)
 {
   sRichText += 'Document-' + index + '';
 }

  var myHyperlinks = NWF$('.cssHyperlinks');
  myHyperlinks.html(sRichText);
 
  NWF$('.cssUrlLinks').toggle();
});

There are a few requirements for this to work.

1. Create a field in your initial list to hold a semi-colon delimited list of urls

2. Add a Rich Text control to your Task form and give it a CSS class like “cssHyperlinks”

3. You should have a Single line of Text control on your task form, connected to your field from Requirement 1 above.  If not, add a control and connect it.  Also, add a CSS class to this control, and call it something like “cssUrlLinks”.

4. Finally, go into the Form Settings -> Custom JavaScript and add the above JavaScript.

Enhancement

The above JavaScript will create links with names like Document-0, Document-1 etc.

If you want to be smarter, your workflow that builds up the URLs can do something cool like DisplayName,URL;DisplayName;URL.

Notice the DisplayName and URL is comma-delimited.  Your JavaScript would need to be updated to split on semi-colons and then split on commas so that you have a URL and a nice Display Name for the link (it could be the document name).

Downloads

Nintex Workflow/Forms for Office 365

Download the Workflow- Download it and import into the New Workflow page

Leave a Reply

Your email address will not be published. Required fields are marked *