Skip navigation
All Places > Getting Started > Blog > 2015 > August
2015

Products: Nintex Workflow for Office 365

 

Summary

Unable to design Nintex Workflows in Office 365 on Team Sites.

 

Symptom


Issue when loading Nintex Workflow designer in Office 365:

"Cannot connect to retrieve your license information. Please try again, and if the problem persists, , contact Nintex Support.”.

and/or:

"Error connecting to the workflow manager: Operation is not valid due to the current state of the object”

 

Cause


This can occur if sites are standard Team Sites deployed from Web Templates. Team Sites from Web Templates are not created with the Workflow Service Store feature and therefore SharePoint workflows cannot run.

 

Resolution


You can use PowerShell to add the missing feature:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")

#authenticate
$secureString = ConvertTo-SecureString ###password### -AsPlainText -Force
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext("https://###.sharepoint.com/sites/###/")
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials("admin@######.onmicrosoft.com", $secureString)
$ctx.Load($ctx.Web);
$ctx.ExecuteQuery();

# Add Workflow Service Store
$guid = [System.Guid]"2c63df2b-ceab-42c6-aeff-b3968162d4b1"
$ctx.Web.Features.Add($guid,$true,[Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
$ctx.ExecuteQuery();

# Add Workflow Task
$guid = [System.Guid]"57311b7a-9afd-4ff0-866e-9393ad6647b1"
$ctx.Web.Features.Add($guid,$true,[Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
$ctx.ExecuteQuery();

 

Thanks to WoodoWeb. For the full post please see http://woodoweb.com/?p=241

Symptoms

 

You may have seen following error "[workflow name] failed to run" in the workflow history list of your workflow. The strangest part being the workflow runs successfully despite the errors displayed. This generally happens when the workflow enters a "dehydrated" or "paused" state.

051012_1935_pausedworkf1.png

Upon reviewing the ULS logs for this workflow you may find the following messages:

 

OWSTIMER.EXE (0x0E5C) 0x2184 SharePoint Foundation Workflow Infrastructure 72fu Unexpected Load Workflow Class: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.Workflow.SPWinOeHostServices.EnsurePluggableServices(SPSite site, SPWorkflowExternalDataExchangeServiceCollection services, ExternalDataExchangeService existingServices) at Microsoft.SharePoint.Workflow.SPWinOeHostServices..ctor(SPSite site, SPWeb web, SPWorkflowManager manager, SPWorkflowEngine engine)

OWSTIMER.EXE (0x0E5C) 0x2184 SharePoint Foundation Workflow Infrastructure 98d8 Unexpected System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.Workflow.SPWinOeHostServices.EnsurePluggableServices(SPSite site, SPWorkflowExternalDataExchangeServiceCollection services, ExternalDataExchangeService existingServices) at Microsoft.SharePoint.Workflow.SPWinOeHostServices..ctor(SPSite site, SPWeb web, SPWorkflowManager manager, SPWorkflowEngine engine)

OWSTIMER.EXE (0x0D64) 0x0E98 SharePoint Foundation Workflow Infrastructure frg9 Medium Workflow could not be run because SPWebApplication.UpdateWorkflowConfigurationSettings was not previously called, and the Web Application service has been disabled on this server. Call UpdateWorkflowConfigurationSettings or turn on the Web Application service for this server.

 

Cause

 

Farm Topology:

Service Applications 05.png-700x0.png

 

When a workflow has been queued for resumption and the Application server with the “Microsoft SharePoint Foundation Workflow Timer Service” tries to resume the workflow, it fails to run due to not having the “Microsoft SharePoint Foundation Web Application” service enabled. This error occurs because the Workflow Timer Service tries to read the workflow settings from the web.config or configuration database for the web application. By default, the workflow settings are stored in the web.config file of the server that is running the “Microsoft SharePoint Foundation Web Application” service.

 

When running workflows on application servers that are not configured to be front-end servers, the Workflow Timer service requires workflow configuration settings in Web.config to be set in the configuration database. This must be done through a script that calls UpdateWorkflowConfigurationSettings() on the SPWebApplication object, which will copy the Web.config settings from a front-end server. The script can be found below in the Microsoft recommended solution.

 

Resolution

 

We recommend stopping/starting the services on the servers in your farm that should/should not be running them. In order to avoid Nintex licensing errors we recommend you review you Nintex Workflow License and ensure your farm topology matches your license and adjust your services accordingly. To assist you with this process please refer to and follow this article: Workflows and the SharePoint services required to run them.

 

Microsoft recommends the following to resolve these "Failed to run" errors:

Method 1)

Locate one Web Front End server which has Web Application service running, run the following PowerShell command to copy workflow-related configuration from the web.config to the configuration database so it will be available from every server in the Farm.

$webapp = Get-SPWebApplication -identity http://<web app name>

$webapp.UpdateWorkflowConfigurationSettings()

 

Method 2) Start the Web Application Service on all servers that have the Workflow Timer Service running.

 

Method 3) Disable the Workflow Timer Service on servers that are not running the Web Application service.

(Source: https://support.microsoft.com/en-us/kb/2674684)

 

Please note: the “Microsoft SharePoint Foundation Web Application” service provides web server functionality. Starting or stopping this service will deploy/remove files from the C:\inetpub\wwwroot\ directory. Please perform this action at your own discretion.

warning.png WARNING warning.png

Running a powershell script on everything in your farm can have a large unforeseeable performance impact.

Know that these scripts do no discriminate on what site or site collection they run on.

They will target everything in the site collection / web application scope.

The scripts below are provided as is and should be reviewed carefully before executing

 

-----------------------------------------------------------------------------------------------------

 

The following scripts can be used to activate features (Not just nintex!) on all objects in a farm. Whether the feature is scoped as a "Site" or "web" feature depends on what command you will need to use. Once again, please be aware that this can tax your farm quite a bit depending on the size of your farm and number of sites. I have added a pause to the script to reduce this impact.

 

Feel free to adjust the "Start-Sleep" command to the number of seconds you are comfortable with between iterations. I have set the sleep time to a default "5" seconds to avoid anybody executing this script without heeding its warnings.

 

Activate a site scoped feature on all site collections in a single web application:

(Potential Performance Impact: LOW )

You can use this script to activate a Site scoped feature on all site collections in a web application.

$feature = Get-SPFeature "EnterFeatureDisplayNameHere"

$siteCollections = Get-SPSite –WebApplication "EnterYourWebApplicationURL"

$siteCollections | ForEach-object {Enable-SPFeature -identity $feature -Url $_.Url; Start-Sleep -s 5}

Activate a web scoped feature on all sites on all site collections in a web application:

(Potential Performance Impact: VERY HIGH )

You can use this script to activate a web scoped feature on all sites/subsites in all site collections in a web application

$feature = Get-SPFeature "EnterFeatureDisplayNameHere"

$site = Get-SPSite –WebApplication "EnterYourWebApplicationURL"

$site | Get-SPWeb -Limit all | ForEach-Object {Enable-SPFeature -Identity $feature -Url $_.URL; Start-Sleep -s 5}

Activate a web scoped feature on all sites in a single site collection:

(Potential Performance Impact: MEDIUM )

You can use this script to activate a web scoped feature on all sites/subsites in a single site collection.

$feature = Get-SPFeature "EnterFeatureDisplayNameHere"

$site = Get-SPSite -Identity "EnterSiteCollectionURL"

$site | Get-SPWeb -Limit all | ForEach-Object {Enable-SPFeature -Identity $feature -Url $_.URL; Start-Sleep -s 5}

 

As a reference here is a list of the Nintex Features and their scopes:

 

NintexFormsFarmada0910e-a663-4db4-a19c-d8a097317b8715Farm
NintexWorkflowClaimsMigration4db97f4c-e643-4b1b-9f6a-43a9d817e6a215Farm
NintexFormsWebApplication0cdf436f-61b0-43d2-b250-4360f0353b6315WebApplication
NintexFormsListSite202afc3c-7384-4700-978d-6da3d3cce19215Site
NintexFormsLiveSite23fce797-ac15-4451-b8da-cf8ac6de691215Site
NintexFormsSitePrerequisites716f0ee9-e2b0-41f0-a73c-47ed73f135de15Site
NintexFormsWorkflowSiteac8addc7-7252-4136-8dcb-9887a277ae2c15Site
NintexWorkflow0561d315-d5db-4736-929e-26da142812c515Site
NintexWorkflowContentTypeUpgrade86c83d16-605d-41b4-bfdd-c75947899ac715Site
NintexWorkflowEnterpriseWebParts53164b55-e60f-4bed-b582-a87da32b92f115Site
NintexWorkflowInfoPath80bf3218-7353-11df-af9f-058bdfd7208515Site
NintexWorkflowLiveSite54668547-c03f-4bb5-aaab-d9568ebaf9c915Site
NintexWorkflowWebPartseb657559-be37-4b91-a369-1c201183c77915Site
NintexFormsAdminWeb70f4f7da-4fb4-4e30-ba1a-a733efb2e1ac15Web
NintexLiveAdminLinks29e9a673-31a4-46a3-b0d2-d8e1db1dbd9214Web
NintexWorkflowAdminf7937973-0cf9-4f2d-a549-be2d3c25b77215Web
NintexWorkflowEnterpriseAdminaa61ef91-ee2b-42d5-9911-7c6557ad90c215Web
NintexWorkflowEnterpriseWeb2fb9d5df-2fb5-403d-b155-535c256be1dc15Web
NintexWorkflowLiveAdminWeb485f5158-4b8a-453f-9eeb-7b33f5112adf15Web
NintexWorkflowWeb9bf7bf98-5660-498a-9399-bc656a61ed5d15Web

 

A final note: The "NintexWorkflow" site feature needs to be activated BEFORE the "NintexWorkflowWeb" web feature. Some features may have dependencies on other higher scoped features. I generally recommend you test activating a site/web feature to ensure it works before executing these scripts.

 

Alternatively you can use these commands to deactivate features if needed! Instead use the Disable-SPFeature in place of the Enable-SPFeature.

 

Please let me know if you have any questions.

 

Cheers,

Andrew Beals

Hello everyone,

 

This week we have a new video to show you with community champion and new Ninster Eric Harris. Enjoy!

 

Preface

 

I've been on a number of collaborative calls with Microsoft investigating paused/failing timer jobs and decided to share the process used to track a rogue workflow that is running amok.

 

If you are seeing workflow timer jobs across your entire farm fail one by one in succession then it's likely there is a particular workflow being rehydrated that is causing your workflow timer job to pause or fail. Once this timer job pauses/fails the workflow failover timer job will pick up this rogue workflow and execute it again on the next available timer job in the load balancer pool thus leaving you with no workflow timer jobs running on your farm.

 

PLEASE NOTE:

This guide should not be used to troubleshoot all issues with workflow timer jobs. Please review the following document first: Workflows not continuing - Timer Service and Delays

 

Additionally, a workflow timer job can pause, fail or run for a very long time if you have large amounts of workflow data. The following documentation should be addressed first before pointing the finger at a rogue workflow:

 

Defensive Workflow Design Part 1 - Workflow History Lists

Demystifying Workflow History (Part 1)

 

Large amounts of unmanaged workflow data generally make up for 90% of the failures we see with pausing or long running workflow timer jobs. This is due to how SharePoint writes/queries information to/from SQL when involving large SQL tables. (e.g. the larger the table, the longer it will take to query).

 

Now, after taking all that in to consideration, let's move on to the guide!

 

Gathering information

 

1) Set ULS logging levels on “Nintex Workflow 2010” and “Workflow Infrastructure” to Verbose.

image001.gif

2) Run the ‘New-SPLogfile’ (Technet: New-SPLogFile) cmdlet in a SharePoint Management Shell window afterwards to start a new log file using the newly configured settings (Verbose).

 

3) Wait until the issue (hung timer job) occurs again, give it about 10-15 minutes after the first job hangs. Then gather logs from each of the servers, or have the customer merge the logs using the ‘Merge-SPLogfile' (Technet: Merge-SPLogFile) command.

 

4) Once you have the logs, you will need to use ULS viewer (Download ULS Viewer from Official Microsoft Download Center) to view and filter them. Open ULS viewer and import each log file and applying a filter to each as shown below:

 

image002.gif

After the filter is applied, you will see one of two things;

 

1) You will see a workflow compile, start and never complete (as shown below):

image003.gif

   This is a good indication that this is the workflow that is causing your timer job to fail. Since the telemetry scope    never closes we can see that this is the last workflow being compiled and most likely the culprit.

 

2) You will see workflows compile and run. When finished, you will see a “closing workflow telemetry” message    indicating the job has completed. (as shown below)

image004.gif

 

If you find the first option, this is a good indication that this is the hung workflow timer job. The workflow that compiled right before the hang is likely the workflow that you should be focusing efforts on.

 

Identifying the workflow

 

If you are not familiar with the particular workflow name found in the logs or you don't know where to find this workflow, you can use the following process to gather more information.

 

First you will need to use the workflow instance ID found inside of the ULS logs:

 

Next insert the workflow instance ID into this SQL query and run it:

USE NW2010DB --Update to the name of your Nintex Content Database.

SELECT * FROM dbo.WorkflowInstance

WHERE WorkflowInstanceID = '408c7d6a-b919-4c84-b7b8-e410e6b3d2d3' --Change Workflow Instance ID to track additional workflows

This query will provide you with the workflow name, site id, list id, (sub) webid, item id, and other identifying information so that you can find the specific instance of the workflow. Your results should look like the following:

image006.gif

 

Tracking down the workflow

 

Now that you have something to work with you can use the below PowerShell Scripts/Commands to gather information necessary for tracking down the workflow if the customer isn’t sure exactly where this workflow exists.

 

Find all Site Collection IDs:

Add-PSSnapin Microsoft.Sharepoint.Powershell

Get-SPSite | SELECT URL, ID, RootWeb

Example output:

image007.gif

 

Find all Web ID's (sites/subsites) in a site collection:

Add-PSSnapin Microsoft.Sharepoint.Powershell
$site = Get-SPSite http://yoursitecollection
$site.AllWebs | select ID, URL, Title

Example output:

 

Find all ListIDs in a sub-site:

Add-PSSnapin Microsoft.Sharepoint.Powershell
$site = Get-SPSite http://YourWebUrl (change me!)
$web = $site.OpenWeb("subsitename") #<---- Add the subsite title here
write-host "Site: " + $site.id
write-host "Web: " + $web.id
$web.lists | SELECT Title, id

Example output:

image008.gif

 

Terminating the workflow Instance

 

Once you know which workflow you are dealing with, there are a couple of options to terminate the instance to restore your workflow timer jobs from a pausing state.

 

1) Terminate the workflow using Microsoft supported methods: Cancel or terminate a workflow instance

2) Using a web service call using the Nintex Workflow web service by passing the workflow instance ID. Endpoint: (http://SiteCollectionUrl/_vti_bin/nintexworkflow/workflow.asmx) Method: (TerminateWorkflow)

3) Using the following PowerShell script:

 

#Terminating specific workflow instances with PowerShell.

#For the problematic workflow instance IDs, you can now use them to begin cleaning things up.

#This is especially useful for runaway workflows generating lots of activity in the dbo.workflowprogress table.

#Open the SharePoint Management Console and for the PowerShell commands below, replace references like <Enter SiteID here> with the GUIDs in inverted commas from the above results. Eg: “61543AD-7562-TFR43D-76T5-7645535”

 

#using SiteID column

$site =Get-SPSite <Enter SiteID here>;

$siteurl = $site.url

 

#Site URL

$web = Get-SPWeb $siteurl;

$web.AllowUnsafeUpdates = $true;

 

#Get List by guid using listID from DB

$ListID = <Enter ListID GUID here>;

$list = $web.Lists.GetList($ListID,$true);

 

#use the ItemID from DB ..Note: in Powershell its zero based so itemID minus 1

$items = $list.Items; $myItemid = <Enter ItemID here>;

$item = $items[$myItemid - 1]; ## as per the table where the WF ran on, you can display $item.Title to make sure that you selected the right correct Item

 

#Get this Item WorkFlows collection

$WorkflowCollection = $item.Workflows;

 

#Get WF instance ID from DB

$InstanceWFId = <Insert WorkflowInstance ID GUID here>;

$wf = $WorkflowCollection | where { $_.InstanceId -eq $InstanceWFId}

 

#Cancel Workflows

[Microsoft.SharePoint.Workflow.SPWorkflowManager]::CancelWorkflow($wf);

$web.Dispose();

 

The above script is also attached to this article. Just be sure to change the file extension to .ps1 from .txt and follow the commenting inside the script to configure the script correctly.

 

Cheers,

Andrew Beals

Senior Service Engineer

You can create Workflow Support Packages so as to get information about some trouble you have had on a workflow instance to analyze it or to be sent to Ask Support when you create a ticket with some issue.

 

You can find that option on Sharepoint Central Administration on the "Nintex Workflow Management" section. There, you 'll find the option "Nintex Workflow support Console".

You can use this page to monitor workflow errors on this server farm and create support packages for troubleshooting.

On that page you will see a list of workflow instances with error with a link that says "Create Workflow Support Package"

 

So you can click there and then you will see that a .zip file is created and ready to be downloaded containing the following files:

 

 

 

 

Here below is an extract from the Nintex Help File.

 

 

Support packages

Support packages are used to collect key diagnostic information about Nintex products and their configuration for troubleshooting purposes.

Note: Support package information may include configuration information about the SharePoint farm, Nintex products including license details, workflow designs, workflow configuration, and log extracts. Please consider the contents of each support package carefully before passing to a third party.

Support package types

The following types of support packages are available:

 

    • Farm support packages
    • Workflow support packages

 

Each support package type contains the following information.

 

Information

Farm support package

Workflow support package

SharePoint farm

X

X

Nintex configuration

X

X

ULS logs

X

X

Workflow instance

X

 

Support package contents

The contents of a support package depends on the support package type.

 

SharePoint farm information

The SharePoint farm information contains the following data:

    • SharePoint database information
    • Email configuration including incoming and outgoing
    • Alternate access mapping information
    • Servers within the farm
    • SharePoint products installed, including patch levels
    • SharePoint services status
    • Farm feature status
    • Farm solutions installed and deployment status

 

Nintex configuration information

          The Nintex configuration information contains the following data:

    • Nintex Workflow global settings information
    • LazyApproval Settings
    • Nintex database configuration and mapping information
    • Nintex Live information
    • Nintex Form information
    • Nintex workflow for Project Server information
    • Nintex license information

 

ULS log information

The ULS log information contains a time-bound extract of the farm ULS Logs for each server within the farm as logged via SharePoint.

  • For farm support packages, the extract covers the last hour.
  • For workflow support packages, the extract covers the duration of the workflow, up to a maximum of five minutes.

The level of detail in the ULS logs is determined by the farm logging configuration in SharePoint.

 

Workflow instance information

The workflow instance information contains the following data:

  • The workflow design as exported from the designer (the .nwf file)
  • The workflow history for the specific workflow instance
  • The compiled workflow code as used by the workflow engine
  • Verbose logging information, if that feature is enabled within Nintex Workflow

Suppose there is a single valued list look up component that provide the information of a user role depending on user login name. Now if we want to display this role from that list look during document.load function we will found it empty. Since the value of list look up component gets populated after sometime of document.load function, it shows blank. The situation to overcome this is to set a timer function in document.load so that the list look up get a chance to get populated. After getting that role we can easily disable/enable the fields of the form using JQuery. So we can have multiple view of a same item for different role based user. This could be a substitute of a single value look up in Office 365 that is yet to implement.

In the recent request for community members to name their favourite workflow action, I put forward the "Copy To SharePoint" action, this was down simply to the element of surprise, that it helped me do exactly what I wanted to, easily, with no hacking, or fudging, as we call it.

 

I had a requirement for attachments in an event calendar to be treated like true SharePoint managed documents when uploaded by users.

 

Step 1

We've created an OOTB calendar. We've also created a document library called "Event Resources" and in that library we've added some Site columns, the ones that will contain metadata in the event calendar that we want to associate with the document. The meatdata is important because we will use it later to give the users a nice way of viewing the documents.

 

Step 2

We will create a workflow that will run on Create or Modfied and the first action we will insert is "Copy to SharePoint", this action will basically try to copy the event item to a document library, but it's actually going to copy the attachment into the document library as a document in it's own right, and by ensuring we tick "Copy item meta data" it will add the metadata to the document in the library as well. Perfect.

 

C2S.PNG

 

Step 3

Shout out to Paul Crawford who helped me see the errors of my ways with the convaluted approach I was taking to this next part. So we need to now delete these attachments, after all, they are no longer needed here and we don't want to duplicate the data. So we're going to Call a WebService.

getattachement.PNG

We're going to be using the lists.asmx WebService and we'll invoke the "GetAttachmentColleciton" method. Pass it our list (the calendar) name and the ID of the current item and store it in a Multiple lines of text field as it will be spat out in XML.

 

Step 4

We're going to be querying the XML we just got and storing the URL's in a collection. The XML node is simply called "Attachment" so configure your action as below.

queryxml.PNG

 

Step 5

Use the "For Each" action to iterate your way through the collection storing the attachment url from the collection into a text variable. We're going to use another "Call WebService" action and use the lists.asmx WebService again to delete the attachment. The for each will loop through, so for multiple attachments they will all be deleted.

deleteattachment.PNG

So you can see we're just passing the calendar name, the ID and the url given to the attachment. It's important to do it this way because the WebService encodes the URL differently, using "+" for spaces rather than %20, so getting the URL through a WebService ensures that it's correctly formatted.

 

Step 6

Finally, we're going to have to present this to the user in a nice friendly way when they open up the event item, so we want to edit the list form and add the list view webpart for our "Event Resources" library to the bottom of the form and create a connection from the event item webpart to the list view webpart on a common piece of metadata. In this case I used Title, but it might be whatever suits you to ensure it's unique.

event.PNG

So there we go, 2 working documents linked nicely to our event.

I recently had a request to get the AD user accounts expiring in 30 days from today's date, using Nintex Workflow.

 

The Background:

An AD timestamp (AKA LDAP time, WinTime or FileTime) is the number of 100-nanoseconds since the year 01/01/1601 @ 00:00.

 

There's a number of online tools that help us calculating this. For example,

    • To get the number of 100-nanoseconds between the years 01/01/1601 @ 00:00 and 01/01/2016 @ 00:00,

                     we can use silisoftware online free tool

                    So, 130960980000000000 is the number of 100-nanoseconds between 01/01/1601 @ 00:00 and 01/01/2016 @ 00:00, and it's also the AD timestamp for 01/01/2016 @ 00:00

 

The Challenges:

  1. Convert date/time format to AD timestamp.
  2. Convert the AD timestamp produced from the calculations, to a text readable by AD.

 

The Solution:

  1. To convert date/time format to AD timestamp:

Nintex allows us to get the number of seconds since 01/01/1900 @ 00:00, so we will have to do 3 steps to get the number of 100-nanoseconds since 01/01/1601 @ 00:00:

  1. Get the number of seconds since 01/01/1900 @ 00:00, save in varNum_secsSinceJanFirst1900.
    1. In a "Set variable" action:

Set:

YourNumberVariable (varNum_secsSinceJanFirst1900)

 

 

 

 

Equals:

Workflow Data

YourDateTimeVariable

(varDate_TodaysDate)

Number of Seconds since 00:00:00 1/1/1900

 

 

2. Multiply var_secsSinceJanFirst1900 by 10^7 (100-nanosecs), save result in var_100nanoSecsSinceJanFirst1900

    • So, varNum_100nanoSecsSinceJanFirst1900 = varNum_secsSinceJanFirst1900 * 10^7

 

3. Add the number of 100-nanoseconds between 01/01/1601 @ 00:00 and 01/01/1900 @ 00:00, to varNum_100nanoSecsSinceJanFirst1900, save result in varNum_requiredDateinADTimeStampFormat.

              • The number of 100-nanosecs between 01/01/1601 @ 00:00 and 01/01/1900 @ 00:00, taking into consideration the leap years is: 94354848000000000, you'll have to trust me on this.

 

The calculations combined are as follows:

varNum_requiredDateinADTimeStampFormat = (varNum_secsSinceJanFirst1900 * 10^7) + 94354848000000000

 

 

2. To convert the AD timestamp produced from the calculations, to a text readable by AD:

The result of the calculations done above, is something like this: 1.3086031037335E+17, if you pass the number in this format to AD, AD won't recognize the number as an AD timestamp, and you will get zero result.

An AD timestamp is an 18 digit number, so we need to convert 1.3086031037335E+17 to 130860310373350000. We can do this by following these steps:

  1. Convert the varNum_requiredDateinADTimeStampFormat number variable to text, save in varText_requiredDateinADTimeStampFormat.
  2. Apply the following inline functions to varText_requiredDateinADTimeStampFormat:
    1. Remove the dot ('.'):
      1. fn-Replace({varText_requiredDateinADTimeStampFormat},.,)
      2. Store in the same field: varText_requiredDateinADTimeStampFormat
    1. Remove 'E+17':
      1. fn-Replace(varText_requiredDateinADTimeStampFormat,E+17,)
      2. Store in the same field: varText_requiredDateinADTimeStampFormat
    2. Add zeroes to complete 18 digits:
      1. fn-PadRight(varText_requiredDateinADTimeStampFormat,18,0)
      2. Store result in the same field: varText_requiredDateinADTimeStampFormat

 

 

This how it looks combined:

Replace WorkflowVariable:sl_12hrsBeforeADTimeStamp in the below screenshot with WorkflowVariable:varText_requiredDateinADTimeStampFormat

 

The result of the above string operations should be something like this: 130860310373350000, when you pass this to AD, you should get the expected results.

 

The whole workflow is as follows (attached):

Just by luck i found a great feature to populate a Calculated Value Field with HTML.

With it, it´s possible to dynamicly populate a Field, even in a Repeating Section with Pictures.

The best part is, that it is super easy to configurate.

 

Here is an example Form i designed. In it there is a Reapeating Section with a List Lookup and a Calculated Value Field.

form.jpg

 

The List Lookup is connected to the SharePointList "HW-SW-Artikel" and not more is configurated. It just shows all ListItems in it.

In the Calculated Value Field is a lookup on the same List. It gets the HTML value, based on the List Lookup from the SharePoint List.

The Calculated Value Field now recalculate the HTML and shows the picture.

 

lookup("HW-SW-Artikel", "ID", LookUp, "HTML-Link")

 

List Lookup.jpgCalculatedValue.jpg

 

The HTML Code in HW-SW-Artikel SharePoint List

 

SharePoint List.jpg

<a href="https://community.nintex.com/community/build-your-own/content?filterID=contentstatus%5Bpublished%5D~category%5Bbest-practices%5D" target="_blank">
<img src="https://community.nintex.com/resources/images/palette-1068/headerLogo-Nintex-Connect.png" alt="Logitech Performance Maus"  style="width:200px;height:75px;border:0;"></a>

 

 

The Result is an easy way to populate a repeating section with pictures.

Also the link on an images is working and it opens the right href link in a new tab.

repeating.jpg

 

Hope it helps someone =D

Hello community!

 

Continuing the tradition of new content, let me introduce a new video series we'll be doing for the community! Watch the short intro video below to find out more

 

 

I've been referencing the MSDN articles a lot recently on Date and Time format strings and sometimes I get confused by the many options and sometimes these formats do not carry over or function. So I wanted to build a quick reference sheet that I can refer to in my workflows and forms.

 

First, how to use the inline and runtime functions.

 

fn-FormatDate in Workflows

Represents a date time value in text of a specific format.

 

Usage

fn-FormatDate({WorkflowVariable:MyDate}, d)

 

Other Notes

  • For workflow inline functions, using single quotes takes the value as a literal. So for the formateDate function fn-FormatDate({WorkflowVariable:MyDate}, 'D') provides the value of D.
  • Using double quotes or no quotes produces the same result. For example:

fn-FormatDate({WorkflowVariable:MyDate}, "dd/MM/yyyy") and fn-FormatDate({WorkflowVariable:MyDate}, dd/MM/yyyy) both produce 11/08/2015

fn-FormatDate({WorkflowVariable:MyDate}, "D") and fn-FormatDate({WorkflowVariable:MyDate}, D) both produce Tuesday, August 11, 2015

  • If you attempt to calculate for a time format, but the value provided is date ONLY, then the function will result in an error.

 

Time Calculations

For Time intervals, I found that using a single h, to provide the non-leading zero hour does not work and results in an error. But if you use the special format character % you can get the result of a non-leading zero hour digit. For exmaple: fn-FormatDate({WorkflowVariable:MyDate}, %h) returns 8, while fn-FormatDate({WorkflowVariable:MyDate}, hh) returns 08.

 

formatDate on Forms

Returns the date in the specified format.

 

Usage

formatDate(date, format) or formateDate({namedControl}, "D")

 

Other Notes

  • In the format string, using single or double quotes is required. Using no quotes results in an error.

 

 

Table of Date and Time Format Strings

The specified format can incorporate structures such as "dd/MM/yyyy" or "dddd", "dd MMM". Alternatively, single character format specifiers can be used. The components of these structures include:

Element Description Example (in US date format)

 

Format Specifier

Description

Examples

Result

"dd"

Day of month (double digit) 3/1/2017 

fn-FormatDate({CurrentDate}, "dd")

01

"ddd"

Day of week (Abbreviated) 3/1/2017 

fn-FormatDate({CurrentDate}, "ddd")

Wed or W (see notes)

"dddd"

Day of week (Full) 3/1/2017

fn-FormatDate({CurrentDate}, "dddd")

Wednesday

"MM"

Month (Numeric) 3/1/2017

fn-FormatDate({CurrentDate}, "MM")

03

"MMM"

Month (Short) 3/1/2017

fn-FormatDate({CurrentDate}, "MMM")

Mar

"MMMM"

Month (Full) 3/1/2017

fn-FormatDate({CurrentDate}, "MMMM")

March

"yyyy"

Year 3/1/2017 1:45:30 PM

fn-FormatDate({CurrentDate}, "yyyy")

2017

"%h"

Hours (12 Hour) 3/1/2017 1:45:30 PM

fn-FormatDate({CurrentDate}, "%h")

1

"hh"

Hours (12 Hour) 3/1/2017 1:45:30 PM

fn-FormatDate({CurrentDate}, "hh")

01 in WF, but 1 in Forms

"HH"

Hours (24 hour) 3/1/2017 1:45:30 PM

fn-FormatDate({CurrentDate}, "HH")

13

"mm"

Minutes 3/1/2017 1:45:30 PM

fn-FormatDate({CurrentDate}, "mm")

45

"tt"

AM or PM 3/1/2017 1:45:30 PM

fn-FormatDate({CurrentDate}, "tt")

PM

"d"

Short date pattern 3/1/2017

fn-FormatDate({CurrentDate}, "d")

3/1/2017

"D"

Long date pattern 3/1/2017

fn-FormatDate({CurrentDate}, "D")

Wednesday, March 1, 2017

"M", "m"

Month/day pattern 3/1/2017

fn-FormatDate({CurrentDate}, "M")

March 1

"s"

Sortable date/time pattern 6/15/2009 1:45:30 PM

fn-FormatDate({CurrentDate}, "s")

2009-06-15T13:45:30

"t"

Short time 3/1/2017 1:45:30 PM

fn-FormatDate({CurrentDate}, "t")

1:45PM

"T"

Long time 3/1/2017 1:45:30 PM

fn-FormatDate({CurrentDate}, "T")

1:45:30PM

"Y", "y"

Year month 3/1/2017 1:45:30 PM

fn-FormatDate({CurrentDate}, "Y")

March 2017

"M/d/y"

Short Date pattern 3/1/2017

fn-FormatDate({CurrentDate}, "M/d/y")

3/1/17

"d/M/y"

Short Date pattern 3/1/2017

fn-FormatDate({CurrentDate}, "d/M/y")

1/3/17

"MM/dd/yyyy"

Short Date with leading zero Day and Month

fn-FormatDate({CurrentDate}, "MM/dd/yyyy")

03/01/2017

"M/dd/yyyy"

Short Date with leading zero Day

fn-FormatDate({CurrentDate}, "M/dd/yyyy")

3/01/2017

"MM/d/yyyy"

Short Date with leading zero Month

fn-FormatDate({CurrentDate}, "MM/d/yyyy")

03/1/2017

 

NOTES:

  • dd - will provide a two digit days, so the first of the month will be 01
  • MM - will provide a two digit month, so March will be seen as 03. Using a single M will be just 3, a single digit. Notice that capital M is month and lowercase m is minutes.
  • d - can be used in two different ways. "d" by itself provides a short date pattern 3/1/2017, while using d in a date pattern like "M/d/y" will provide 3/1/17. Notice it is a single digit day when appropriate.
  • y - can be used in two different ways. "y" by itself provides a Year Month pattern of March 2017. But using "y" in a date pattern like "M/d/y" will provide 3/1/17. Notice the year is only the last two digits.
  • Using "ddd" provides an abbreviation of the day name. But it was found to react differently based on platform and local
    • On Prem: return W in English, other locals produce a 2 or 3 character response as appropriate. As Marian Hatala noted, the value of day name abbrv is taken from Sys.CultureInfo.CurrentCulture.dateTimeFormat.ShortestDayNames
    • O365: returns Wed

I used Nintex Workflow for several years and always guessed how I could see my favorite actions on the section named "Commonly used"

 

 

I always saw those friendly actions; "Assign Flexi task" and "Send notification", although I built tons of workflows with different actions. I kept asking: What 'd be the mysterious algorithm that Nintex uses to determine my action as "Commonly used".

Is it a magic number?. Yes, it is

After asking it on the Nintex Community, Emily told us that the magic number is 7.

And I said to myself, "I used my favorite action more than 7 times". For example I remember I have a lot of "Change State" actions on my workflows.

The trick is that you must drag & drop 7 times your action on your workflow design to see it on the "Commonly used" Category.

It will not be considered as favorite, for example if you Copy/Paste it 7 times.

 

Let's assume that your favorite action is "Calculate Date".

 

Drag & Drop it 7 times on your workflow design

 

 

 

 

 

Then Save the workflow.

Close it.

And open it again.

 

And now you 'll see your favorite action…

 

 

 

Additionally if you want reset that category, you can delete cookies from your browser.

Sometimes it's needed to count some characters on a string on a Nintex Workflow

 

This sample shows how to calculate it with 3 actions.

 

The used actions are:

 

 

I set a variable named myString with the value 123-1234-12345

 

 

 

 

Then I create the following variables

 

 

 

 

 

 

Firstly I count the total characters on my string using the action named "Convert Value"

 

 

 

Then I count the characters deleting the character you want to count ("-" (hyphen) in this case) , from the string

 

 

 

Then I use the action named "Math operation"

 

 

 

So you get the result on the variable named "myResult"

 

 

 

For the July mission, I asked the community What's your favorite workflow action and why? And for everyone who's interested, I've listed the actions mentioned and also why people love them so. Perhaps you haven't used one of these before. Are you inspired?

 

 

Favorite Workflow ActionWhat the community has to say

Action Set

You can bundle a collection of actions in an action container which can then be collapsed and expanded to make your workflow design more consistent and clean.

  • "This action is a very powerful tool that is great for grouping other actions together. One really neat feature is the ability to configure the action to run as Workflow owner. This is a really powerful feature when you utilize it with the Set item permissions action. ...and the ability to create Snippets from them."
  • "Favorite for grouping and running actions in an other user context"
  • "Being able to group actions for reuse at multiple places in the workflow is such a huge time saver"
  • "Allows reusing of tasks"

Assign Flexi Task

With this action you can assign a task to one or more users, and then request a specific action such as all must agree, or first response applies, or majority choose the outcome. The list of outcomes are chosen by the workflow designer.

  • "You can outcome behaviors, delegate tasks, set reminders, set individual setting for approvers, access to LazyApproval etc"
  • "My users would definitely vote for flexi task."
  • "I'd pick the Flexi task action as it does so much more for just one little box and approvals are at the heart of many workflows. Think about the power - LazyApproval, able to evaluate a set of replies, able to provide and configure a set of outcomes, reminders, escalations, delegations"
  • "So many options to configure each notification it sends. So much functionality in one single task"
  • "...user task delegation (between two dates) can really be some powerful stuff. It's easy to configure, you can attach a custom Nintex forms to it, plus is allows us to set user permissions while and after the task on the item is completed, as a way of allowing us to add security to on the item"
  • Favorite is the flexi task...plus adding Nintex Forms into the mix allows customizing the task form to create some incredibly powerful and user centric forms."

Build String

Allows the workflow to perform basic string concatenations for use within other actions at runtime.

  • "...use this in combination with Create Item and Copy/Move to SharePoint action"

Calculate Date

Allows a time period to be added or subtracted from a date to create a new date.

  • "I configure a lot of reminders in my workflows, phew!!"

Call Web Service Action

Allows the workflow to make a call to a SOAP web service method.

  • "Almost no limit to what you can do with this action! For example; modify settings, create SharePoint groups, retrieve attachments from list items etc without the need to write a custom action. You can also access managed metadata store and other services via webservices."
  • "This is one of the actions that impressed me so much the first time I saw Nintex workflow. This was when I was an older developer, and I was so impressed with this functionality that afterwards I was a Nintex fanboy for life!"

Commit Pending Changes

Forces all existing batched operations to be committed. Batched operations are operations performed by workflow actions that do not commit immediately.

  • "cause that just makes stuff work! Commit early and commit often"
  • "pause, commit and logging help keep me sane "

Copy to SharePoint

Allows the workflow to copy items from the current library to another library within SharePoint.

  • "...in terms of being pleasantly surprised, I loved finding out that Copy to SharePoint would extract an attachment from a List Item and copy it to a SharePoint document library, complete with metadata."
Looping/ Run If/ For Each family
  • "SPD workflows don's have this functionality OOTB and I use it all the time...the other day I had to use SPD to simply send an email to a contacts lists, pretty straight forward with Nintex but in SPD? Not easy!"
  • "If I really have to select the best, then I would say For Each loop...we lacked this functionality in OOTB SP workflows. Coming from there, this was gold!"

Regular Expression

Perform a regular expression on a block of text. You can perform an operation on the specified string using a regular expression (pattern), including replacing, splitting, and extracting strings, as well as checking for a match.

  • "This action allows you every kind of manipulation of strings, you can extract, split and a lot more things! "
  • "I use it on so many occasions to evaluate or manipulate data."
  • "RegEx action "

Request Approval

This action allows you to request one or more users to process an approval as part of the workflow.

  • "It's amazing how you can assign an approval for a number of people. It is also pretty cool how to approvers get to comment on why they approved or declined the approval sent to them by email! A great way of communicating and getting things done in a really busy organization where people are in and out of the office"

Request Data

Assigns a task to a specified user. To complete the task, the user must provide a value for each data item specified in the action configuration.

 

  • "Definitely my most used action. So powerful in combination with Nintex Forms."

Social Actions

 

E.g. Post to Yammer, Wordpress, Twitter

  • "We created a monthly reporting form/workflow solution where supervisors have the option of elevating notable staff submissions up to executive level visibility. Executives can share a post with the whole company via Yammer with a simple tick of a checkbox. Completely automated - LOVE IT!"
  • "I think the social actions are great - being able to post items to twitter or yammer"

State Machine

The state machine action provides a construct where you can define the number of states a workflow can be in, the workflow will continue to move between these states based on approval tasks, and until you tell the workflow to end.

  • "A lot of customers ask for workflows with a step back or a step forward depending on approval tasks, and it's simple to use and offers something that cannot be done with SharePoint Designer 2010 workflows"
  • "Favorite because it allows for workflow flow control"
  • "I like the state machine action because it's useful for recurring workflow areas or modeling purposes"
  • "Hands down the State Machine. The added ability to move to different parts of the process at any time, all in the context of a single workflow, is super convenient and valuable."
  • "Use the State machine as the heart of a lot of workflows. Its a great way to organize separate processes within the workflow and allow you to repeat steps when necessary"

Switch

This action will direct the flow of actions based on the value of a single variable. A branch for each possible defined value is used to determine which branch of workflow actions will run.

  • "I'll give a shout out to the switch action, who I took for granted until trying to build something in O365 before it was available"
  • "My favorite is the Switch workflow action. I have several programs that use this logic"

Web Request Action

With this action you can send an HTTP request to a URL, and perform a variety of requests, including GET, POST, PUT, SOAP 1.1, SOAP 1.2, and customized request methods. You can also use this action to call ASMX web services.

  • "You can call SharePoint 2013 REST API requests, your own web services, ones from other systems and...interact with other applications without coding! Definitely awesome!"

 

Honorable mentions

Filter Blog

By date: By tag: