In a company, I am working for, we have been using Nintex Workflow + SP + Infopath for a while now, and we run into some problems with these technologies when we started thinking of creating offline forms and mobile integration. Unfortunately, InfoPath could not provide us with options. So, I have started looking for solutions which will be easy to develop and will provide some flexibility like InfoPath does, when you want to connect to different services and bring data from different platforms.

I saw Lightswitch before, but I am HTML guy, so I didn’t actually think to replace InfoPath with Lightswitch at that time. But when Microsoft released their new Lightswitch HTML client with set of good built in controls and with options to publish apps directly to Sahrepoint 2013, I Started playing with it.

The first task for me was to create a simple HTML client which brings data from a Sharepoint list. User can create/update/delete items. It takes about 10-15 minutes to complete the whole example using out of the box tools in Lightswitch.



Simple Work flow to assign a task to Person when Item is created


Now we have working client, next we need to prepare a web service with couple methods to process tasks and to provide workflow history.

But before that, we need to know which security mode our Sharepoint site is using. For my SharePoint environment, I am using NTLM security mode and I would say that it makes everything more complicated, when you want to connect to services in SharePoint(2010). As I am using NTLM I am not able to use windows authentication in my WCF RIA service as NTLM is only allow 1-hop solutions. It means that I need to create custom web service in a middle between Lightswitch and SharePoint, to utilize Nintex SDK. Nintex dll provides a good sdk to retrieve and action Tasks.

For those who are not familiar with Nintex Workflow, there are two methods in /_vti_bin/Nintexworkflow/Workflow.asmx

1) GetRunningWorkflowTasksForCurrentUserForListItem (itemId,listName)

2) ProcessFlexiTaskResponse (comments,outcome,spTaskId,taskListName)

From the first method you can retrieve TaskID, which you can use in the second method to action the task. The problem with Nintex web service is

that it is using windows authentication to process a Flexi task response. In my case I am not able to pass windows credentials from WCF RIA service to Nintex web service, that’s why I am creating a custom web service in a middle to impersonate user who is running the Ligthswitch application.

I am not going to example how to create a web service in sharepoint 2010, there are dozens of articles explaining that. What you need to do is to reference Nintex SDK dll in your sharepoint project.

Here is code for web service:

When you deploy the sharepoint solution you will be able to navigate to the service:


Next we need to create a new WCF RIA service to use in our Lightswitch application. Here is a step-by-step instruction how to do it: here

After you create a simple WCF RIA service, you need to add references to our custom web service and to Nintex web service. We need it to do just once, because we

want VS to generate for us all proxy classes from these services. After we will overwrite Endpoint addresses from the connection string which we will pass to our WCF RIA service.

Here is our WCF RIA service in Solution Explorer.


Here is code:

After we build NintexRIA project we need to add data source to our Lightswitch application:


Now we need to select 3 entities (they are for Pending Tasks, History and Different Outcomes)

Also we need to specify a connection string which will be passed to RIA service. As I wanted to build very generic WCF RIA service, which I can reuse after

everywhere in my lightswitch projects, to be able to use that service we need to pass just 3 parameters:

1) Site Url (service has to know where to look for Nintex web service and our custom web service)

2) List (Listname where our items located)

3) WFName (we need to know workflow name to be able to get Workflow history. We can have many workflows for List, so we need to filter for which workflow we want to get history)

After we added new Data Source the server will look similare to this:


Now Lets add a new Tab to ViewTestList.lsml and name it Tasks:


To get a list of pending tasks we need to have a ListItemID and current user. So add new Data Item to ViewTestList screen:


Bind ListItemID parameter to Task.ID


And drag and drop query to the screen:


When we run the app we should see something similare to this:


Now add tap event for Tasks table. We want to be able edit task(Approve/Reject).


Delete all fields except Comments


Add new Data Item:


And Bind TaskID parameter to Task.TaskID


Drag and Drop query on the screen just before Comments field and delete all fields except Outcome Tetx


Finilly, when we run the app and tap on the task item we will get popup window:


Next select Write code and add following:

We need to set Task Outcome ID to the value from OutcomeInfo list.


Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">