Archive
How to create a link to Nintex Start Workflow Page in the document set home page
In this blog post, I’d like to show you how to create a link to start Nintex Workflow Page in the document set home page.
1. Firstly, you need to upload the latest version of jQuery to the style library of your team site.


2. Then, upload a text file to the style library for writing your own html and JavaScript

3. In the document set home page, insert a new content editor web part and link the text file you just upload.

4. Update the text file with the following content, you can download this file here.
<script type="text/javascript" src="/Style%20Library/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="/_layouts/sp.js"></script>
<script type="text/javascript">
$(document).ready(function() {
listItemId=getParameterByName("ID");
setTheWorkflowLink("YBBESTDocumentLibrary");
});
function buildWorkflowLink(webRelativeUrl,listId,itemId)
{
var workflowLink =webRelativeUrl+"_layouts/NintexWorkflow/StartWorkflow.aspx?list="+listId+"&ID="+itemId+"&WorkflowName=Start Approval";
return workflowLink;
}
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
if(results == null){
return "";
}
else{
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
}
function setTheWorkflowLink(listName)
{
var SPContext = new SP.ClientContext.get_current();
web = SPContext.get_web();
list = web.get_lists().getByTitle(listName);
SPContext.load(web,"ServerRelativeUrl");
SPContext.load(list, 'Title', 'Id');
SPContext.executeQueryAsync(setTheWorkflowLink_Success, setTheWorkflowLink_Fail);
}
function setTheWorkflowLink_Success(sender, args)
{
var listId = list.get_id();
var listTitle = list.get_title();
var webRelativeUrl = web.get_serverRelativeUrl();
var startWorkflowLink=buildWorkflowLink(webRelativeUrl,listId,listItemId)
$("a#submitLink").attr('href',startWorkflowLink);
}
function setTheWorkflowLink_Fail(sender, args)
{
alert("There is a problem setting up the submit exam approval link");
}
</script>
<a href="" target="_blank" id="submitLink"><span style="font-size:14pt">Start the approval process.</span></a>
5. Save your changes and go to the document set Item, you will see the link is on the home page now.

Notes:
1. You can create a link to start the workflow using the following build dynamic string configuration:
{Common:WebUrl}/_layouts/NintexWorkflow/StartWorkflow.aspx?list={Common:ListID}&ID={ItemProperty:ID}&WorkflowName=workflowname.
With this link you will still need to click the start button, this is standard SharePoint behaviour and cannot be altered.
References:
http://connect.nintex.com/forums/27143/ShowThread.aspx
How to use html and JavaScript in Content Editor web part in SharePoint2010
Nintex workflow tips and tricks
Here are some Nintex 2010 workflow related tips and tricks and I will keep updating them.
1. How to add a link in email using Nintex.
a. Go to the insert tab and select Link

b. Select the url you’d like to set for the link

c. After you have done this , you will see the Link is inserted into the email.

2. How to make the Flexi task reject option called “Decline” and make the comments mandatory.
a. Open the Flexi task action config prompt as shown below
b.Click on the edit icon and change the settings from
TO
3. When saving or publishing Nintex workflow and receiving the following errors:
Server was unable to process request. —> The file hxtp://../NintexWorkflows/Workflowname/Workflowname.xoml is checked out for editing by Domain/Username.
To Fix it , you can perform the following steps:
a.In the publish dialogue, uncheck “Overwrite existing version” and rename the workflow.
b.Delete the old workflow which was checked out
c.Publish the new workflow again with the old name
d.Delete the “temporary” workflow again
How to use Nintex Reusable Workflow Template
If you like to re-use your workflow logic over more than one list or library, you can create reusable workflow template. Here are the steps
1. Go to site settings and create reusable workflow template.

2. Select the content type you like the template to bound to and give a workflow a title.

3.Create your workflow the same way as you did for a list workflow and publish your workfow.

4. Finally, you need add your workflow to the list you like to run your workflow.
5. Go to workflow settings and add a Workflow.

6. Select the content type and configure the workflow as below

7. After you done this, your workflow will run as usual.
Note:
1. You cannot conditionally start your workflow.
2. Your workflow is not automatically bound to the list when you add the content type to the list, you need to configure it manually as shown in step 4-6.
How to Use User-defined function using Nintex workflow
In Nintex workflow, you can create re-usable workflow logic by creating user defined function. The user-defined function is very similar to a method defined using c# or java. You can have input parameter and output-parameter. You then call the user defined function by passing in the parameter and return the output parameter. Here are the steps:
1. Create your user defined action

2. Define your output and input parameters


3. Create your workflow logic as normal and publish your user defined action.

4. You can call the user defined action from your main workflow.


Note:
1. One of the limitation for the user defined action is that you cannot create Person or Group variable.
How to combine several files into one PDF using Nintex and Muhimbi PDF Converter
Recently I am using Nintex workflow and Muhimbi to build a solution for a client. One of the requirement is to combine several files within the document set into one , this is really simple to do with Muhibmi PDF Converter and Nintex.
1. You need to activate the Muhimbi PDF Converter – Nintex Workflow Integration feature at the Web Application level.

2. Then, we need to retrieve the sever relative URL path for the document set as shown below.(You can use URL Path or Server Relative url property when you query the list)

3. Then, we need to build the combined PDF path.

4. Next, we need to build the paths for all documents we need to combine.

5. Finally, we need to perform the conversion using the Muhimbi Nintex action below

You can download the Nintex Workflow here.
*****************Update 07/01/2013****************
@muhimbi PDF converter Merge files to PDF action does not work inside a IF or LOOP action when used in @Nintex workflow.Have to change all my @Nintex IF action to Set A CONDITION action to make @muhimbi PDF converter Merge files to PDF action works.I also checked with Muhimbi PDF converter support ,I was told that upgrade to the latest version of the product will solve the problem , I have not tried yet and will update here once I have tried it.
The error I am getting is An error has occurred in [Workflow Name].
*****************Update 13/01/2013****************
Another problem I am having is to invoke the workflow using the document set item rather than a document inside the document set.You will get the error message “An error has occurred in [Workflow Name]“. To resolve the problem you need to configure the Source List and Source List Item properties for the conversion as shown below.
References:
Convert and Merge PDFs using Nintex Workflow and the PDF Converter for SharePoint
How to invoke Nintex workflow asynchronously using code
In this post, I will show you how to invoke Nintex workflow asynchronously using code. Nintex is built on top of SharePoint, so there is no difference between invoking a Nintex workflow and invoking a SharePoint workflow. Below is the code to invoke the workflow.You can download a sample code here and updated version can be found here (including cancel the workflow when the work is already starting)
References
How to check if Workflow is already Running and to Avoid Error Exception from HRESULT: 0×8102009B
Starting/Canceling a SharePoint Designer workflow programmatically
Extend Nintex Workflow 2010 Trial
You can extend Nintex Workflow 2010 trial license by getting Trial license from Nintex and import to your SharePoint Development Machine. Next, you need to reactivate your license to your Web Application as below.










