Skip navigation
All Places > Getting Started > Blog
1 2 3 Previous Next

Getting Started

454 posts

This works with on-prem Nintex Workflow 2013

Problem:  Upon archiving a document I use workflow to update the date/time field of when the archive happened.  When user wants to un-archive the document, I need to clear the date field to display as empty (or null).

 

Resolution

  1. Create variable vDateArchivedDate as Date and Time with blank default date
  2. Use Convert value action input "1/1/0001" and store in variable vDateArchivedDate
  3. Use Set field value to update the date column with workflow data > vDateArchivedDate

Download

 

Changes

  • Not Applicable

 

Bug Fixes

 

Source Code

technunes

LAR, doce LAR

Posted by technunes Jul 9, 2018

If you are wondering what “lar, doce lar” means, this is the exact Portuguese translation for “home, sweet home”. Obviously, the context of this article has nothing to do with the pleasure of being returning home, but the he Lean, Automate and Robotize (LAR) approach can and should be just as sweet and can also avoid some painful experiences in the future.

Before we get deeper into the topic, bear in mind that LAR is the result of my own experiences around automating business processes, and it is not a known term in the community. While I do not have the ambition to push one more acronym into our work routine, I do hope, for the sake of security, efficiency and cost reduction, the approach gets implicitly adopted as a best practice.

There is of course a bunch of articles mentioning that the processes should be optimized before being automated, but with the hype around Robotic Process Automation (RPA), we need to revisit the subject as RPA can also offer a risk for your process automation initiative. After all, your competitive edge hinges not on whether you automate, but how you do it.

So, let’s get some definitions straight:

·        Lean (in a service context) is a process optimization methodology that focuses on improving the effectiveness and efficiency of a process by eliminating activities that do not add value to the customers and the product.

·        Automation of business processes is a technology-enabled approach that is performed to achieve digital transformation or to increase service quality or to improve service delivery or to contain costs.

·        Robotic Process Automation is a computer software or a “robot” to capture and interpret existing applications for processing a transaction, manipulating data, triggering responses and communicating with other digital systems.

An analogy that I like to use when comes to business processes is that a business process is like a road through the mountains and, due to people, systems and procedures, it is full of curves and ups and downs.

The goal of the process optimization is about creating a bridge that will connect the start to the end of the process in the most efficient way. 

In a complex scenario however, this business process can involve ERP systems, legacy systems, office tools and many more. Altogether, this can also offer some change management challenges.

In addition, business will depend on IT to build this bridge and what supposed to be simple, can turn up to be a very sophisticate project, leading to delays, huge implementation costs and frustrations.

As Mike Fitzmaurice would say: in the best of all possible worlds, we would be able to get the requester and the developers a mind meld, but life is not like star trek and mind meld is not real.

The RPA can solve this problem by keeping the process as it is, but let robots to drive the “cars”. Robots can at some level, respond to events just as humans would.

This is all great, but more often than we think, a hybrid approach would be the most appropriate. While we all know that the integrations with an ERP system may bring the complexity of a project to high levels, and many legacy systems does not offer a proper API that can easy out a possible integration, there are parts of the process that can and should be optimized in a proper way. Nintex technologies empowers users to achieve just that, avoiding the IT bottle neck.

The RPA approach should not be considered the answer for everything and a more efficient approach would be the combination of the best of both worlds. For example, by replacing the excel spreadsheet with a proper digital form (mobile enabled) and avoiding the back-and-forth of emails through a proper workflow around a form. 

Lean and automating are very connected and they overlap in many levels because it often involves a process optimization in a digital format. The initiative of automating a process, like introducing a digital workflow, most likely show opportunities to enhance the process itself. In the same way, the initiative of enhancing a process will frequently result on some sort of automation adoption. The robotizing part is connected with the automation because it offers a mechanism of interaction with digital systems in an automatic way, but does not attempt to substantially change the AS-IS process. It is also important to notice that LAR is part of the continuous improvement process defined in Lean.

The fact that RPA does not attempt to change the AS-IS process, gives the idea that the Robotic Process Automation is always an easier, faster and more cost efficient than any other automation approach. This is however not always the case.

What if building the proper bridge did not require IT muscle? That’s where Nintex Technologies come in place.

The scenario below shows the process around receiving an offer, creating a P.O. and receiving an invoice.

·        The requester asks the supplier to send an offer.

·        The supplier sends an offer (email text, pdf, word, excel or even PowerPoint).

·        The offer is validated by the requester.

·        The offer is sent to the internal responsible to create the P.O.

·        The P.O. is created in SAP and sent to the supplier.

·        The supplier will then send the invoice.

This could eventually been addressed by EDI (electronic data interchange), B2B systems or API calls, but it is difficult to expect that all business partners from different sizes, regions and segments can easily adopt such approach. The Robotic Process Automation would then be good candidate to automate this process.

However the “Read document/ extract data” part of the process can be quite challenging because RPA tools does do magic. PDF is a business standard document format and it would be fair to demand the offers to be sent on this format. With that in mind, a robot can be configured to read the offer from the offer repository and using some intelligent OCR and text analysis, figure out who is the supplier, the total amount for the offer and basically transform all unstructured or semi-structured data into structure data. The problem here is that the PDF contained the offer can be formatted in several different ways and it is unlikely that the RPA tool would be able to get the data in a trustful way, unless it attempts to use a 3rd party product like Abbyy to achieve that, which would raise the complexity and the operational cost.

So, let’s revisit the process and apply LAR into it.

At the very start of the process, there is an exchange of email between the requester and the supplier in order to get the offer. The supplier sends an email with the offer attached. The offer document is in a semi-structured format and, as we have seen earlier, it implies some challenges to our automation with the RPA tool.

A way to optimize the process would be to eliminate the email exchange and establish a way to collect the structured data.

Using Nintex Workflow cloud, a business user can easily create an online responsive form to handle the offer submission and the workflow to handle the approval form.

The offer form can be divided into sections. While the Supplier and Offer sections collects the master data for the offer document, the Info and Signature sections support the overall process.

The workflow engine would consume this request and handle the approval of the offer. Additionally it is possible to connect to the cognitive services for text analysis and data classification. 

 

In our example, we capture the sentiment of the comment provided in the Info section. In case the comment is something positive like “20% discount is already applied”, the process will continue in one path of the workflow. If a negative message is provided, like “the offer is only valid until the end of this week”, then the process will follow another path in the workflow.

Using Nintex DocGen, a well formatted document is generated. This document can be the trigger for the RPA robot to start the P.O. process. Alternatively, the Robot can be called directly from the workflow as the orchestrator exposes a web API.

The overall architecture is represented on the image below:

 

 

A solution like the one described in this article is achieved with a no-code approach and can be delivered by business users in a matter of hours. RPA is an excellent technology but should not be considered the answer for all the automation initiatives.

LAR will support the creation of the proper bridges when is feasible and let the RPA do what RPA is good at – to take the robot out of people.

Even a short workflow can generate quite a few variables. When you assign a variable to tasks, the names are presented in alphabetical order. The variables list itself displays the order in which they were created. This makes it difficult to find a particular one to delete for example while refactoring or just coming up for a name for a new variable.

It was such an exercise that prompted me to write the attached script which sorts the variables into order, either by Name or Type and Name.

After exporting the workflow to the filesystem, the script edits the workflow and always writes it to Sorted.NWF – so that the original file is preserved should you need to revert to it.

Trying to use pure xml defeated me, so I used the brute-force method of extracting the WorkflowVariables section and converting it to an xml object, sorting it and pasting it back into the workflow file.

Usage:

Assume the script is in the same location as your downloaded .NWF file

.\Sort-WflowVariables.ps1 .\MyWorkflow.nwf

Will sort the variables in name order

While

.\Sort-WflowVariables.ps1 .\MyWorkflow.nwf -ByType

Will sort the variables first into their type and then into order of name

This can then be imported back into the designer where you will see the variables listed in the order requested.

As ever with scripts from the internet, please review its contents to ensure that you are happy to run it in your environment.

Share&Enjoy

Ever wondered how to display SQL table inside your Nintex Form? Indeed, there is the “SQL Request” action, but it only allows you to show data from database as a dropdown, list of options, etc… and always – just a single column.

However there is an easy solution for that. The approach I am using includes usage of the “FOR XML” command in a SELECT statement (source). It is available in SQL Server starting from version 2008. It returns data from a query using an XML format, concatenated in a single row, in a single column. Perfect format to parse it!

Step by step

1. First prepare your SELECT query. Mine is for example:

  1. SELECT TOP(1) (SELECT name, lastname, email, role
  2. FROM users
  3. RIGHT JOIN roles ON roles.Id = users.roleId
  4. ORDER BY lastname ASC
  5. FOR XML) as datatable FROM users

With such statement I am sure, that I will receive just a single row and column, that will return the data in a proper XML format. Each row will be built using the following structure:

  1. <name>value</name><lastname>value</lastname><email>value</email><role>value</role><name>value</name><lastname>value</lastname><email>value</email><role>value</role>...

Put the query in the “SQL Request” control inside your form:

SQL Request action Nintex Forms

Set the field not to be visible. It is not going to be used directly.

2. Now add a “Calculated Value” control. It will be used to get the output from the “SQL Request” and parse it into a valid table. I am using the following formula to achieve it:

  1. '<table class="dataTable"><thead><tr><th>Name</th><th>Lastname</th><th>Email</th><th>Role</th></tr></thead><tbody>'+replace(replace(replace(replace(SQL REQUEST CONTROL NAME, '</role><name>', '</td></tr><tr><td>'),'\<\/(?!td|tr)[a-zA-Z]+\>\<(?!td|tr)[a-zA-Z]+\>','</td><td>'), '</role>', '</td></tr>'), '<name>', '<tr><td>')+'</tbody></table>'

It simply creates a ready to use HTML table. It replaces ending and starting XML tags to starting and ending <tr><td> tags (to mark start and end of each row).

3. Next define a CSS styles for your table. I used the following page to create a set of CSS: https://divtable.com/table-styler/ 

Done!

The table is ready to be shown:

HTML table out of SQL table

I hope this can be find useful for you.

Hello!
 

In my job I’m doing lots of bits and pieces, tweaks enhancements etc to SharePoint solutions I've built using Nintex forms and workflows among other things. I thought to myself I should record the things I do in a central place rather than them getting lost in various emails, tickets, thoughts, phone calls etc.! I started with a simple excel spreadsheet but then thought, why not create a sharepoint list and basic form that I can quickly add to…

 

 

 

 

Why would I use it? To log things in case changes I make break later down the line, weekly meetings, to show what I'm doing \ done to my manager and for my Appraisal perhaps. It evolved a bit as well from my original idea. I added a status field allowing me to tag items as in progress, that I can complete or add comments to at a later date. The workflow updates the item with comments and closing date. It's also been shared with everyone and a simple page created to show todo and completed items.

 

 

 For reporting I've connected it to excel. My favourite simple and quick reporting method for all things SharePoint.

 

 


So this is a really simple solution using a basic list with a Nintex Form and Workflow attached. The buttons on the form control what the workflow will do.

List, Form and Workflow attached...

 

 

 

T

For a long time, we have been plagued by times in InfoPath forms jumping forward by an hour during daylight saving time after amending the metadata fields.

Investigation shows that the datetime value written back to the form contains a modifier telling SharePoint that the time is recorded as being GMT (and thus an hour needs to be added to make it ‘correct’ again).

Date field in InfoPath form

<my:StartDate>2018-05-23T00:00:00Z</my:StartDate>

The solution was to use Nintex to create a workflow that rewrites the date fields after change to remove the ‘Z’ character.

The workflow could either run on any change – or fine tune it to run only when one of the affected fields change value

The action is to

  • Retrieve the field value from the xml document
  • Test if it contains a ‘Z’
    • If it does, write it back without the ‘Z’

As it runs immediately after a change, it is worth starting the workflow with a ‘Commit pending changes’

The first step is to read the xml document associated with the current item, so insert a Query XML task – ensure the source is the Current Item; return the result as Text, to a temporary string variable

In the Output, set ‘Process using’ to XPath and click the XPath Builder button and navigate through your form’s xml to the field

When you reach it, select it and click the Apply button and something like this will be returned

 

Now test strTest in a Run If

Within the Run If, add an Update XML task

You can copy/paste the field reference from the Query XML task

You then replace the node content with the item value for the field, replacing the ‘Z’ with a blank

Note that the FormatDate function returns the date/time in the same format as that stored within the xml.

Now repeat this for each affected field.

graham

Nintex Workflow – Fast Loops

Posted by graham Jun 12, 2018

Recently I needed to create a schedule of dates, one week apart. I created a loop and added 7 days in each iteration. I noticed it took a very long time, so I added a Log in History task in the loop and saw that each iteration was taking 5 minutes. I realized that this was down to ‘Safe Looping’.

This protective feature places some safety measures against the hazards of an infinite loop by adding a hidden delay..

I didn’t want to disable this option, mainly because of the maintenance overhead involved, so I looked for another option.

I realised that the Collection iteration (For Each) didn’t have any such restriction, so all I needed was to create a collection with the number of entries that I wanted to loop for.

The Regular Expression task with the Split operator is the easiest way to create a collection; it simply splits text based on a character. All I had to do was to create a string with the right number of delimiters.

This is where I got the idea for this article https://community.nintex.com/community/build-your-own/blog/2018/06/08/nintex-string-repeat.

Now, as n delimiters will create n+ 1 entries, we need to reduce the number of delimiters by 1

Initialising the string to a non-delimiter will ensure that the string is padded to length ‘Iterations’ containing n-1 delimiters.

Regular Expression

For each

 

We place the retrieved value in TempStr variable and ignore it.

Calculate date:

Here’s where we add the recurrent +7 days added on each loop

The final workflow

 

 

I set the Iterations variable to be a startup parameter and set it to 10

Here are the results from the history - as you can see, it all executed immediately

 

Time

Event

Message

11/05/2018 10:49

Workflow Comment

MyDate=18/05/2018 10:49

11/05/2018 10:49

Workflow Comment

MyDate=25/05/2018 10:49

11/05/2018 10:49

Workflow Comment

MyDate=01/06/2018 10:49

11/05/2018 10:49

Workflow Comment

MyDate=08/06/2018 10:49

11/05/2018 10:49

Workflow Comment

MyDate=15/06/2018 10:49

11/05/2018 10:49

Workflow Comment

MyDate=22/06/2018 10:49

11/05/2018 10:49

Workflow Comment

MyDate=29/06/2018 10:49

11/05/2018 10:49

Workflow Comment

MyDate=06/07/2018 10:49

11/05/2018 10:49

Workflow Comment

MyDate=13/07/2018 10:49

11/05/2018 10:49

Workflow Comment

MyDate=20/07/2018 10:49

 

 

graham

Nintex String-Repeat

Posted by graham Jun 8, 2018

I recently needed a String-Repeat function in a workflow. But it doesn’t exist.

Or does it?

Looking at the inline function specifications, I saw that the PadLeft function (and PadRight) adds a number of characters to a string, until the string length is the desired number of characters long.

If you needed just a specific number of characters (lets say ‘-‘ chars), then the following

fn-PadLeft(-,15,-)

 

Will result in a string of 15 ‘-‘ characters

Now, you cannot tell it to pad out with a string of more than 1 character (it actually returns the text of the function definition when you try), so you need to be a little more clever to give a string of 15 repetitions of ‘Graham’ for example

We create a string of 15 ‘-‘ characters then replace each ‘-‘ with the longer text that we want to repeat in a RegEx task.

graham

Workflow Approvals Dashboard

Posted by graham Jun 5, 2018

This article is not strictly Nintex, as it could apply to any workflow engine.

We manage our Change Control process using InfoPath forms and Nintex workflow.

For a management overview and reminder for when approval request emails are missed, we needed a dashboard page that would show all outstanding approvals and those assigned to the current user.

Two methods were identified to provide this functionality – the Nintex webparts and custom list views of the WorkflowTasks list.

This is a summary of our requirements

Requirement

Nintex Webpart

Custom Listview

Display the ID of the item being approved

N

N

Link the item being approved to open in the browser

Y

N

Group all approvals for each item

N

Y

Ability to Approve from the page

Y

Y

Ability to Delegate from the page

N

Y

 

Whilst the Nintex webpart allows the current user to respond to a task if s/he is the one to whom the task was assigned, the Terminate Workflow option is visible and could cause problems - and the Delegate user was not available at al.

Our first attempt to solve this was to add a column to the WorkflowTask list and have a workflow paste in the relevant information each time a task was created. Big mistake – we had no end of ‘Task is locked by a workflow’ errors and resulted in delays of hours before an approval could be given.

Returning to the List Views, because the views are grouped, we did not want the name of the grouping field to be repeated in each group, so we used the JScript found here -> http://bistesh.blogspot.co.uk/2014/04/sharepoint-20132010-remove-columns-name.html and added it to a CEWP. We used this code as a basis to edit the url of the Related Content to use the InfoPath form server.

It also amends the standard message:

'There are no items to show in this view of the "Workflow Tasks" list. To add a new item, click "New".'

To show

'You have no outstanding approvals'

 

We wanted to be able to show the ID of the related content.

Research indicated that SP 2013 held a field called WorkflowItemId – a Content Query webpart (CQWP) was created using the debugging style to retrieve a field of this name and found it existed in SharePoint 2010 and was populated with the ID value.

Debugging XSLT

<xsl:template name="debugCustomStyle" match="Row[@Style='dCustomStyle']" mode="itemstyle">

<!-- shows all the fields supplied and their names  -->

<xsl:for-each select="@*">

F:

<xsl:value-of select="name()" />

=

<xsl:value-of select="." />

+

<br />

</xsl:for-each>

<xsl:call-template name="repeatstr">

<xsl:with-param name="num" select="20" />

<xsl:with-param name="str" select="'-'" />

</xsl:call-template>

<br />

<!-- shows all the nodes supplied and their names  -->

<xsl:for-each select="//*">

F:

<xsl:value-of select="name()" />

=

<xsl:value-of select="." />

+

<br />

</xsl:for-each>

<xsl:call-template name="repeatstr">

<xsl:with-param name="num" select="50" />

<xsl:with-param name="str" select="'='" />

</xsl:call-template>

<br />

</xsl:template>

 

The Property CommonViewFields of the webpart source was set to include all the wanted fields (it is imperative that the case matches the definition, otherwise it will not be recognised).

<property name="CommonViewFields" type="string">Title;WorkflowName;WorkflowLink;AssignedTo;Related Content;WorkflowListId;WorkflowItemId</property>

The next thing was to show it in the view – this field is not selectable as it is hidden. The answer was to export the ListView webpart (see Export a List Webpart at the end) and edit the embedded view

<property name="XmlDefinition" type="string">&lt;View Name="{CE1736B1-205B-42D4-99B6-AE5D5F723D18}" MobileView="TRUE" Type="HTML" Hidden="TRUE" TabularView="FALSE" DisplayName="" Url="[redacted]" Level="255" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/issues.png"&gt;&lt;Query&gt;&lt;GroupBy Collapse="FALSE" GroupLimit="30"&gt;&lt;FieldRef Name="WorkflowItemId"/&gt;&lt;/GroupBy&gt;&lt;OrderBy&gt;&lt;FieldRef Name="WorkflowItemId" Ascending="FALSE"/&gt;&lt;FieldRef Name="AssignedTo"/&gt;&lt;/OrderBy&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name="WorkflowOutcome"/&gt;&lt;Value Type="Text"&gt;Pending&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;ViewFields&gt;&lt;FieldRef Name="WorkflowItemId"/&gt;&lt;FieldRef Name="WorkflowLink"/&gt;&lt;FieldRef Name="WorkflowName"/&gt;&lt;FieldRef Name="Created"/&gt;&lt;FieldRef Name="AssignedTo"/&gt;&lt;FieldRef Name="LinkTitle"/&gt;&lt;/ViewFields&gt;&lt;RowLimit Paged="TRUE"&gt;30&lt;/RowLimit&gt;&lt;Aggregations Value="Off"/&gt;&lt;ViewStyle ID="17"/&gt;&lt;Toolbar Type="None"/&gt;&lt;/View&gt;</property>

 

When html un-encoded and reformatted, it looks like this

<View Name="{CE1736B1-205B-42D4-99B6-AE5D5F723D18}" MobileView="TRUE" Type="HTML" Hidden="TRUE" TabularView="FALSE" DisplayName="" Url="[redacted]" Level="255" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/issues.png">

   <Query>

     <GroupBy Collapse="FALSE" GroupLimit="30">

         <FieldRef Name="WorkflowItemId" />

     </GroupBy>

     <OrderBy>

         <FieldRef Name="WorkflowItemId" Ascending="FALSE" />

         <FieldRef Name="AssignedTo" />

     </OrderBy>

     <Where>

         <Eq>

           <FieldRef Name="WorkflowOutcome" />

           <Value Type="Text">Pending</Value>

         </Eq>

     </Where>

   </Query>

   <ViewFields>

     <FieldRef Name="WorkflowItemId" />

     <FieldRef Name="WorkflowLink" />

     <FieldRef Name="WorkflowName" />

     <FieldRef Name="Created" />

     <FieldRef Name="AssignedTo" />

     <FieldRef Name="LinkTitle" />

   </ViewFields>

   <RowLimit Paged="TRUE">30</RowLimit>

   <Aggregations Value="Off" />

   <ViewStyle ID="17" />

   <Toolbar Type="None" />

</View>

 

This makes it a lot easier to read, understand and amend – this will need to be re-edited to remove unnecessary whitespace and carriage returns, then html encoded (or the tag can be set up to be a CDATA entry).

I recommend that you use the field Status as a substitute field, then find/replace it with WorkflowItemId – this should prevent errors when editing the encoded xml.

So the new field WorkflowItemId is added to the view fields and used as the Group By value.

After the webpart(s) have been re-uploaded, if you Edit Webpart and Edit current view, the fields will appear in their correct locations.

The My Approvals – with no assigned approvals

All Approvals

The full jscript is shown here

_spBodyOnLoadFunctionNames.push("HideHeaders");

 function HideHeaders() {   

    var elem;   

    var elements = getElementsByClassName(document, "td", "ms-gb");

    for (var i = 0; i &lt; elements.length; i++) {

        elem = elements[i];

        elem.childNodes[0].childNodes[1].nodeValue = "";

        elem.childNodes[1].nodeValue = elem.childNodes[1].nodeValue.replace(':', '');

        elem.childNodes[2].href="/_layouts/formserver.aspx?xmllocation=" + elem.childNodes[2].href + "&openin=browser";

        elem.childNodes[2].target="_blank";

   }

   

    elements = getElementsByClassName(document, "td", "ms-vb2");

    for (var i = 0; i &lt; elements.length; i++) {

        elem = elements[i];

        if (elem.childNodes[0].nodeName == 'A') {

            elem.childNodes[0].href="/_layouts/formserver.aspx?xmllocation=" + elem.childNodes[0].href + "&openin=browser";

            elem.childNodes[0].target="_blank";

       }

   }

   

    elements = getElementsByClassName(document, "td", "ms-vb");

    for (var i = 0; i &lt; elements.length; i++) {

        elem = elements[i];

         if (elem.childNodes[0].nodeValue == 'There are no items to show in this view of the "Workflow Tasks" list. To add a new item, click "New".') {

            elem.childNodes[0].nodeValue='You have no outstanding approvals';

       }

   }

}

 

/*

Written by Jonathan Snook, http://www.snook.ca/jonathan

Add-ons by Robert Nyman, http://www.robertnyman.com

*/

function getElementsByClassName(oElm, strTagName, strClassName) {

    var arrElements = (strTagName == "*" && oElm.all) ? oElm.all : oElm.getElementsByTagName(strTagName);

    var arrReturnElements = new Array();

    strClassName = strClassName.replace(/\-/g, "\\-");

    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");

    var oElement;

    for (var i = 0; i &lt; arrElements.length; i++) {

        oElement = arrElements[i];

        if (oRegExp.test(oElement.className)) {

            arrReturnElements.push(oElement);

       }

   }

    return (arrReturnElements)

}

 

 

Export a List Webpart

You want to export the list webpart to your pc, to upload on a different site/page or edit it, but the export webpart option is not available.

 

This is where we get funky …. Still in edit page mode, in the browser toolbar, click Tools | F12 Developer tools. Now select the area on the page holding the webpart

 

Search for the text allowExport within the html

See the =false after it, double-click on it and change that to true

Now the Export option is available on the webpart

 

Save it to the pc, then you can edit it and Add webpart and upload the saved one

How to add Save as Draft button functionality and users can modify their own items? 

  1. Please follow this post for Save as Draft button functionality, thanks Dan Stoll for wonderful post.
  2. Under Version settings, set "Content Approval" to Yes and set "Draft Item Security" to "Only users who can approve items (and the author of the item) ". This would help us to hide own draft item from others.  
  3. Under Advanced Settings Set Item Level permissions to "Create items and edit items that were created by the user".
  4. Now Build you Nintex Form by adding two Calculated fields and Save as Draft button.
  5. Set 1st Calculated field Value 
  6. Set 2nd Calculated field Value to  [if IE 9]  [endif] 
    userProfileLookup(Current User, "PreferredName") 
  7. You many hide both these fields under banner by using "bring to front" functionality.
  8. Add Set as Draft button
  9. Add rule and set on 'Save as Draft' and 'Save and Submit' buttons and set following condition - 
  10. Save these changes and publish it. 
  11. Create the workflow for the list.
  12. Add 'Set a Condition' action and set condition 'If Draft field value is equal to Yes' 
  13. If action value is NO add 'Set Approval Status' action to Approved.
  14. Add End Workflow action.
  15. Save these changes and publish it. 
graham

Day of the Week Number

Posted by graham May 29, 2018

Many people have requested a method of finding the date of the Monday in a week.

I have seen several quite complex solutions, but then I read this post https://community.nintex.com/thread/11519 and realised it is a trivial matter.

Firstly, create a collection of the 3-letter day abbreviations (this should be done for your current locale, for other locales use the appropriate 3-letter day name abbreviations) and should be in uppercase. The easiest way is to use a Regular Expression and split

MON;TUE;WED;THU;FRI;SAT;SUN

around the ‘;’ character.

Regex - Split

Then add a collection operation that tests if fn-ToUpper(fn-FormatDate(DoWDate,ddd)) exists in the collection of days, returning the result in a number variable DoWNum.

Collection operation

If you now subtract DoWNum from the given ‘DoWDate’, you will have the Monday date.


( developed for SP2013 on-prem, Nintex forms 2.10 )


This code was inspired by N M whose amazing blog post can be found here. He lifts the curtain on the Nintex rules engine and shows the power of combining Javascript with rules, providing clues to this realtime validation concept.

You can implement this solution right away on any form control without any additional configuration, cut and paste as shown below using these 4 simple steps;

 

1) make sure each form field control is named and the label is associated with the control:

 

2) paste this CSS in the form's Custom CSS setting:

 

.lp-border-red {
  background-color : rgba( 255,0,0,.2 );
}
.lp-border-yell {
  background-color : rgba(255,255,0,0.3);
}
.lp-border-grn {
  background-color:rgba(0,255,0,0.3);
}

 

 

3) paste this Javascript in the form's Custom JavaScript setting:

lpForm = {

 Validate: function( formControlCall, sourceContext, required, isValid ) {
  // Obtain the internal element input name.
  var formControlID = formControlCall.split( "'" )[1] || "";
  var internalElement = sourceContext.find( "[name^='ctl'][formcontrolid='" + formControlID + "']" );
  // During initial load, people control is a placeholder, no internalElement exists yet, so bail, validation will succeed later
  if ( internalElement.length == 0 ) return;
  var internalElement_name = internalElement.attr( 'name' );
  // Scrub the name.

  var intext = internalElement_name;
  var outtext = intext.split( '$' ).join( '_' );
  // Obtain the label associated for-name of internal element.
  var labelBorder = NWF$( "[for^='" + outtext + "']" )
    .closest( '.nf-filler-control-border' )
    .parent();
  // Required missing.
  if( required && isValid ) labelBorder
    .addClass( 'lp-border-red' ).removeClass( 'lp-border-yell' ).removeClass( 'lp-border-grn' );
  // Optional missing.
  if( !required && isValid ) labelBorder
    .addClass( 'lp-border-yell' ).removeClass( 'lp-border-red' ).removeClass( 'lp-border-grn' );
  // Not missing.
  if( !isValid ) labelBorder
    .addClass( 'lp-border-grn' ).removeClass( 'lp-border-yell' ).removeClass( 'lp-border-red' );
  return isValid;
 },
};

 

4) paste this expression into a new rule for each form field you wish to validate

 

( function( formControlCall, isValid ) { lpForm.Validate( formControlCall, sourceContext, true, isValid ) }( "{Control:Self}", {Control:Self} == '' ) );

optional : inside the expression, change true to false to change the field from required to optional

note : in the Condition window {Control:Self} will format itself to appear as {Self} once saved 

 

Done - Enjoy!


 

TL;DR Explanation

 

The above code is a prototype created in an afternoon. There are probably some edge cases that may require additional coding, but this appears to be suitable for all basic form controls.

 

The 3 important concepts from nmarples that he shares in his blog post are:

  • The Rule's Condition expression is evaluated as Javascript. ( This means you can point to any Javascript function in the Condition window and it will be executed )
  • You can pass to your function, both, a reference to the current control as a string parameter
    "{Control:Self}"
    and pass the resulting expression as a boolean parameter
    {Control:Self} == ''
    Nintex Runtime Functions this expression is the same as isNullOrEmpty({Control:Self})
  • During the OnChange event the function and parameters be executed in an IIFE ( what's an IIFE? Google it, it's useful… )

 

CSS

3 classes are used to set the associated control back-grounds to red, yellow or green.

 

Form JavaScript

lpForm : creates a unique namespace where I can safely use any name for my function.

Validate : takes 4 parameters.

formControlCall : a reference to the currently active control
sourceContext : a reference to the context of the DOM
required : true or false ( whether this form field is required or optional )
isValid : true or false ( the result of the provided validation expression - already evaluated )

 

The process of the function

  1. Navigate the DOM to locate the current control's internal element name, it usually looks like: 
    ctl00$PlaceHolderMain$formFiller$FormView$ctl26$ctl16$ac5d43fc_51e7_4d06_b3e8_150731c4bac9
  2. Scrub this name to replace "$" with underscores.
  3. Use the name to locate the associated label control - the label uses an attribute named for.
  4. Locate the parent-border control of the labels.
  5. Use .addClass.removeClass to set the label parent-borders to the appropriate CSS class ( background-color )

IIFE

The immediately-invoked function expression gathers the following run-time provided parameters:

a reference to the current control : "{Control:Self}"

and a the validation expression : {Control:Self} == ''

So the IIFE evaluates these two parameters and passes results into the interior function, were all four parameters get passed to the base Validation function.  Then the base function Validation ultimately returns back the isValid boolean, which could be consumed by the Rule too.

My requirement is to get all o365 users.

I tried two approches:

1) I followed the approach calling service through 'call http service' action but i got an empty results.

(Reference : https://community.nintex.com/message/25149)


2) I used 'o365 search query' action to get all users.

But couldnot get all the users in the response and not able to parse the XML response.

can you please help me out getting all the Users...?

Hi there, folks!

 

You may recall this blog post from a while back by Sean Fiene -- it's a great write-up on how to approach cascading look-ups in Nintex Forms using lookup columns in SharePoint. A summary is: for each set of data you want to create - you need to make a new SharePoint list. It makes sense!

 

But, I, personally, don't like having so many lists. I'd rather just have one place for myself and my clients to update. I wanted to find a new way - and, I have. I'd like to share that with you today so you can poke holes in it, or try it for yourselves. 

 

Let's look at a 1-list set-up for 4 different cascaded sets of metadata.

 

AnimalVegetable

Tier 1Unique 1Tier 2Unique 2Tier 3Unique 3Tier 4
AnimalYMammalYCatYCalico
AnimalMammalCatManx
AnimalMammalDogYPug
AnimalMammalDogBeagle
AnimalAmphibianYTree Frog
AnimalAmbhibianSalamander
VegetableYLeafyYLight GreenYIceburg
VegetableLeafyLight GreenRomaine
VegetableLeafyDark GreenYKale
VegetableLeafyDark GreenSpinach
VegetableLeafyPurpleYCabbage
VegetableRootYBrownYPotato
VegetableRootOrangeYCarrot
VegetableMarrowYOrangeYPumpkin
VegetableMarrowYellowYSpaghetti Squash
VegetableMarrowYellowButternut Squash

 

Let me explain:

 

An issue we have right now is that if we simply use a List Lookup and pull back Tier 1, we will get hella duplication of Animal and Vegetable. Perhaps some day we will have a "remove duplicates" functionality, but right now - we don't.

 

This is where views save the day.

 

  1. For each unique value in Tier 1, I put a "Y" in my Unique 1 column. For consistency, I always tag the first unique item as unique. 
  2. Then, I create a view: Tier 1 - Unique. Filter when Unique 1 = Y. 
  3. Now, when I set-up my List Lookup control in my Nintex Form, I tell it to look at the list called AnimalVegetable and return column Tier 1 using view Tier 1 - Unique. Perhaps I've named that List Lookup something crazy like "Tier 1".
  4. This is repeated for each column, as you'll see above, in terms of setting up views. So I'll end up with a Tier 2 - Unique, and Tier 3 - Unique. And, I can have as many tiers as I like. 
  5. When I want to filter my Tier 2 values based on Tier 1, I set my Lookup List to look at list AnimalVegetable, column name Tier 2, using view Tier 2 - Unique, filtered by control Tier 1. 

 

 

For me, this works really well. How about you? What are your thoughts?

 

Cheers!

 

Rhia

Filter Blog

By date: By tag: