Posts

Showing posts with the label Nintex Workflow 2010

Error deploying Nintex workflow: An item with the same key has already been added

My client recently upgraded their version of Nintex Workflow 2010 and suddenly some of my workflows started to fail on deployment. The following error cropped up: Error deploying workflow: Server was unable to process request. ---> An item with the same key has already been added. ---> An item with the same key has already been added. WTF???? A little digging unveiled the problem - I had two items in a 'Create Item' shape with the SAME DISPLAYNAME. I needed to move the second item to a new 'Update Item' shape in order for it to work. I order to get the workflow to deploy, I had to manually remove the 'duplicate' item from the serialized XML. Hooray!! It was then a simple matter of creating a new shape to update the 'duplicate' value.

Using Nintex 2010 to get a users name from the User Profile Service in Sharepoint 2010

Image
The User Profile Service is powerful, but absolutely useless if you cannot access the information it stores. The following code and shapes will let you extract this precious information and store it in a Nintex workflow variable. I was looking to extract the users' name based on their login. Sounds easy, but ended being a little tricky. The next few steps assume that the User Profile Service is configured and running on your server. (Goes without saying, but I wanted to say it anyway.) First, call the web service. and put the data in a variable. Now the clever bit - xml tags and the appropraite xml namespace around the data so that we can interrogate the data with XPath. <xml xmlns=" http://microsoft.com/webservices/SharePointPortalServer/UserProfileService "> {WorkflowVariable:userProfileServiceReturnXML} </xml> and finally, write a clever XPath query to extract the required value. //defaultNS:xml/defaultNS:Values/defaultNS:ValueDat...

Purge Old Nintex 2010 Workflows

Nintex workflow can be a very helpful tool, but there is currently no automated way to remove orphan workflows. The workflow engine will still try and hydrate - run - dehydrate all 'running' workflows, even if they are attached to orphan lists. I use the following code to remove all my workflows. Please note that this will remove EVERYTHING INCLUDING CURRENT WORKFLOWS. Its very helpful to speed up workflow response time and remove the dreaded 'Nintex is very busy. Please be patient' message. The logic of the code is quite simple. First, generate a list of all the items in the nintex database (based on webId, siteId and listId) that do not exist in the specified content database. Then loop through all the records calling the OOTB PurgeWorkflow stored procedure. You will need to change the variable at the top of the code to match your environment. I have added a 'DATEADD' portion to the code, so that workflows for the last X days are saved. Enough banter,...

Create Nintex Constants in Powershell

My current project has the requirement of a 'dll free' installation. That means that all the good code that was written in C# to create Nintex Constants  (I used http://jaclynsaito.wordpress.com/2011/09/13/creating-nintex-workflow-constants-programmatically/  as a reference) is not allowed on any servers. Bummer. So, how was the problem solved? The solution: Powershells impressive 'Add-Type'. The syntax I used is something like this: Add-Type -TypeDefinition $source -Language CSharpVersion3 -ReferencedAssemblies $references -passThru  -ErrorAction SilentlyContinue (the official blurb is here ) The code is quite straightforward, but the real kicker is the ReferenceAssemblies. By default, Add-Type only gives a limited number of references (System.dll and System.Management.Automation.dll.) So, if I want to add a reference to Nintex.Workflow.dll (which is helpful when trying to add Nintex constants), I will need to provide the full path the dll as part of ...