How to copy items using Nintex Workflow
Nintex does not offer copying items from one SharePoint library to another out of box. However, it is not hard to implement one yourself. You can use the copy.asmx web services to achieve this. Here are the steps below and you can download the source here
1. Create a UDA with the following parameters:

2. Call the copy.asmx service to copy the item from SouceItemUrl to DestinationItemUrl

3. If your destination document library has versioning and check-in/out turned on , you can use list.asmx to check in your file as below:

4. You need to create constant of Credential type named SP_WORKFLOW_WS as below

5. Here is how it looks like in the Workflow designer.

6. To call this UDA, you can perform the following in your workflow

How to write PowerShell code part 4 (using loop)
In this post, I’d like to show you how to loop through the xml element. I will use the list data deletion script as an example. You can download the script here.
1. To perform the loop, I use foreach in powershell. Here is my xml looks like
<?xml version="1.0" encoding="utf-8"?> <Site Url="http://workflowuat/npdmoc"> <Lists> <List Name="YBBEST Collaboration Areas" Type="Document Library"/> <List Name="YBBEST Project" /> <List Name="YBBEST Document"/> </Lists> </Site>
2. Here is the PowerShell to manipulate the xml. Note, you need to get to the $configurationXml.Site.Lists.List variable rather than $configurationXml.Site.Lists
foreach ($list in $configurationXml.Site.Lists.List){
AppendLog "Clearing data for $($list.Name) at site $weburl" Yellow
if($list.Type -eq "Document Library"){
deleteItemsFromDocumentLibrary -Url $weburl -ListName $list.Name
}else{
deleteItemsFromList -Url $weburl -ListName $list.Name
}
AppendLog "Data in $($list.Name) at $weburl is cleared" Green
}
How to write PowerShell code part 1
How to write PowerShell code part 2
How to write PowerShell code part 3
How to write PowerShell code part 4
How to display workflow related tasks in the item display page where the workflow is currently running on in SharePoint2013
In one of the project, I need to display workflow related tasks in the item display page where the workflow is currently running on. To achieve this, I’d like to add the tasks list view web part and using the connected web part to achieve this.(ID=workflowitemid)
However, to make it work I need to unhide the workflowitemid field in the task list, as it is hidden field and also cantogglehidden field is set to false. I need to use reflection to change the cantogglehidden field to true as it only has getter in the API and then I am able to unhide the field. You can download the script here. However, it is not ideal (make your environment not supported by Microsoft) to display tasks this way.
Another way to display the related task is to use SharePoint designer solution with List view web part and data source. Here are the steps.
1. Create a new list display form as below

2. Edit the custom display form in advanced mode.

3. Find the PlaceHolderMain contentplace hoder and insert the DataView by choosing the associated workflow tasks list as below

4. Go to the List View Tools >> OPTIONS

5. Create a Parameter called workflowitemId Parameter which retrieve the value from the ID querystring as below

6. Create a filter based on UIVersion = workflowitemId as below ,we are going to change the UIVersion to WorkflowItemId property later as WorkflowItemId is a hidden field and cannot be selected from the wizard.

7. Replace UIVersion with WorkflowItemId in the caml for the XsltListViewWebPart.
From:

TO

8. Go to the new custom display page at
http://yourserver/Lists/aa/CustomDisplayPage.aspx?ID=414
, you will see the associated tasks are showing in the page.

References:
http://office.microsoft.com/en-us/sharepoint-designer-help/watch-this-design-a-document-review-workflow-solution-HA010256417.aspx
(Video 12 and 13)
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 the client object model with SharePoint2010
In SharePoint2010, you can use client object model to communicate with SharePoint server. Today, I’d like to show you how to achieve this by using the c# console application. You can download the solution here.
1. Create a Console application in visual studio and add the following references to the project.

2. Insert your code as below
ClientContext context = new ClientContext("http://demo2010a");
Web currentWeb = context.Web;
context.Load(currentWeb, web => web.Title);
context.ExecuteQuery();
Console.WriteLine(currentWeb.Title);
Console.ReadLine();
3. Run your code then you will get the web title displayed as shown below

Note:
If you got the following errors, you need to change your target framework from .Net Framework 4 client profile to .Net Framework 4 as shown below:

Change from

TO















