Database Connection Strings
Web service URLs
When moving Nintex Workflow workflows from one environment, such as QA or Development, to another environment such as Production, the above things most likely will change. Most companies will design their workflows, and then after testing and approval, they will move the workflow to Production. What they don't want to do, is modify the workflow when it's Production.
That would defeat the purpose of having the testing phase.
This is where the Workflow Constants come into play. As long as they are named the same in both environments, then workflows that use the constants will function correctly, and will require no modifications in different environments.
Where do I create constants?
You can create constants at the Farm level.
Go to Central Administration->Application Management, and in the Nintex Workflow Management section, click on Manage Workflow Constants.
These constants will be available to every workflow that is designed in your farm.
You can also create constants at the Site level or even the Site Collection level.
On your site, go to Site Settings, and in the Nintex Workflow section, click on Manage Workflow Constants.
You have a choice of 4 types of contants to create.
This should cover all your needs you might have.
Connecting Strings, LDAP Paths etc can call be stored in a String variable.
Credentials that you might want to use in the Execute SQL, Call Web Service or AD related actions, can be created as well, using the credential type.
Creating a Workflow Constant
When you create a constant, you will be provided with the following page :
Most of the fields are self-explanatory, but the last two are interesting.
Sensitive - are for those constants taht you want to be stored encrypted. You may want to do this for Connection Strings that have username/passwords in them. Credential type constants are autoamtically stored in an encrypted form.
Constant is only visible to Administrators - this should be used, if you want to create constants for LDAP Paths and you don't want anyone but administrators performing that sort of functionality in Nintex Workflows.
Using Workflow Constants
I'm going to create a String constant, and store a database Connection String.
As you can see, I gave it a very descriptive name, so that when I need to use it, it'll be easy for me to identify.
I can then go to my workflow, add an Execute SQL action, and when I go to configure the action, I can click on the Insert Reference icon to the left of the Connection String. In the Insert Reference popup, you can scroll to the bottom and see the section for Workflow Constants.
Using Nintex Workflow Constants is that simple. Now when I am happy with my workflow, I can export it, and import it into production. As long as I have the same named Workflow Constant in that environment, then everything will work as expected.
The Workflow Constant functionality, is just another way of making your workflow dynamic in nature. If you decide to go ahead and move a Database to another server, you can simply update the constant, and all your workflows that rely on it, will automatically be updated. No modifications to the workflows or republishing required.