Archive

Archive for the ‘SharePoint 2013’ Category

How to replace the SharePoint date calendar control with more user friendly jQuery calendar control

April 26, 2014 1 comment

When you use the SharePoint date and time type for date of birth field, you will notice that the calendar control is extremely non-user-friendly. You can only navigate month by month as shown below. To resolve the issue, you can customize the list form page using SharePoint designer and replace the OOB calendar control with popular jQuery control. The solution works for both SharePoint 2010,2013 and office365.

Here are the steps for how to achieve this.

1. Open SharePoint designer and create a New List Form called customNew and set as default form for the selected type.

2. Open style library in file explorer and copy jQuery and jQuery UI files into the style library in SharePoint site.

You can download the jQuery and jQuery UI from the web and the content of the contactPersonCustomNewForm.js is as below. I use the dd/mm/yy format as my locale in Regional Settings is English(New Zealand). You need to change this if you live in another country with different date format

$(document).ready(function() {
    	$("img#ctl00_m_g_540b9a50_52dc_4400_a58d_1db99555fddf_ff41_ctl00_ctl00_DateTimeField_DateTimeFieldDateDatePickerImage").parent().hide();
 		$("img#ctl00_m_g_540b9a50_52dc_4400_a58d_1db99555fddf_ff41_ctl00_ctl00_DateTimeField_DateTimeFieldDateDatePickerImage").hide();
	    $("input#ctl00_m_g_540b9a50_52dc_4400_a58d_1db99555fddf_ff41_ctl00_ctl00_DateTimeField_DateTimeFieldDate").datepicker({
		    changeMonth:true,
		    changeYear:true,
		    showOn: "button",
			buttonImage: "/_layouts/images/calendar.gif",
			buttonImageOnly: true,
			defaultDate:"01/01/1970",
			yearRange: "c-20:c+20",
			dateFormat: "dd/mm/yy"
	    });
});

In order to get the image and textbox selector above , you can open IE developer toolbar(click F12) and find the control ID as below:

3. Open SharePoint designer and edit the newly created New List Form customNew.aspx in advance mode. Then copy and paste the following links in the PlaceHolderAdditionalPageHead.

	<SharePoint:CssRegistration name="<%$SPUrl:~SiteCollection/Style Library/themes/ui-lightness/jquery-ui.css%>" runat="server"/>
	<SharePoint:ScriptLink language="javascript" name="~sitecollection/Style Library/jquery-1.10.2.js" Defer="false" runat="server"/>
	<SharePoint:ScriptLink language="javascript" name="~sitecollection/Style Library/jquery-ui-1.10.4.custom.min.js" Defer="false" runat="server"/>
	<SharePoint:ScriptLink language="javascript" name="~sitecollection/Style Library/contactPersonCustomNewForm.js" Defer="false" runat="server"/>

 

4. Now go to the list and click add, you will see the new calendar control as shown below

Advertisements

How to setup AD group to work with SharePoint group security

August 15, 2013 Leave a comment

Issue:

Recently, I am having issues with the permission setup at client side. The way we setup permission is we create AD Group and add the add AD Group to the proper SharePoint Group. If we need to grant permission to a user, we then add the user to the correct AD group. But end user reports that by adding a user to an AD group, this user does not have any access to the SharePoint site.

Solution:

Change the AD Group scope from Global to Universal fix the problem.

From


To


References:

AD Group Scopes from Paul Stork

http://social.technet.microsoft.com/forums/en-US/sharepointadminprevious/thread/79d2af40-3daa-4f61-86e5-5bb54086147f

How to copy items using Nintex Workflow

June 11, 2013 1 comment

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 display workflow related tasks in the item display page where the workflow is currently running on in SharePoint2013

May 30, 2013 3 comments

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)

What is new in SharePoint2013 Workflow

December 22, 2012 Leave a comment

In SharePoint 2013, Microsoft provides a new way for creating workflows while the existing SharePoint 2010 Workflow platform has been carried forward to SharePoint 2013. SharePoint 2013 workflows are powered by Windows Workflow Foundation 4, which was substantially redesigned from earlier versions. These changes bring a major advancement to workflow and make SharePoint workflows to handle much more complex scenarios.

Let’s first look at the high-level architecture of the workflow infrastructure. As you can see from the SharePoint2013 Architecture diagram below, SharePoint 2010 workflow execution was hosted in SharePoint itself, this has been retained in SharePoint 2013 to allow for backward compatibility while Windows Azure Workflow is external to SharePoint and communicates using common protocols over the Windows Azure service bus, mediated by OAuth. Windows Azure Workflow also can be installed on a separate server. This new workflow infrastructure combined with Windows Workflow Foundation 4 provides SharePoint2013 workflow with more capabilities, such as Service Bus messaging, elastic scalability, and managed service reliability.

                

SharePoint2013 Architecture

Next, let’s look at what is new in SharePoint 2013 workflow and how these changes will make it more appealing than SharePoint 2010 workflow.

1. Declarative authoring in both SharePoint Designer and Visual Studio

Workflow authoring is declarative only in SharePoint2013 Workflow. It simplified the way workflows are created and also provides a consistent experience for creating workflow in SharePoint designer and Visual Studio. Workflows are no longer compiled into managed assemblies and deployed to an assembly cache. Instead, XAML files define your workflows and frame their execution. You can see screenshot below on how you create the same workflow in Visual Studio and SharePoint Designer.

SPD Declarative workflow Authoring

Visual Studio Declarative workflow Authoring

Another great feature inside SharePoint Designer is called visual designer for workflow. This feature is enabled when you have installed Visio 2013. It provides a new way to design workflow alongside the traditional text-based workflow designer as shown below.


                

SPD Visual Designer view

2.Workflow stages to tackle more complex workflow scenarios

This is the major improvement made by Microsoft in SharePoint 2013 workflow as it allows you to create declarative state machine workflow using SharePoint. In SharePoint 2010, you can only create sequential workflow using SharePoint Designer. If you like to create state-machine workflow, you need to get a developer involved as it can only be created inside Visual Studio. Sequential workflow can only handle simple workflow as it executes in a predefined order, on the other hand, state machine workflow can model more complex workflow as it is event driven. Depending on different state, certain actions will take place.

3. New workflow actions and data type to enhance workflow capability

SharePoint 2013 adds several new SharePoint actions to extend the workflow capability. I will highlight some of the significant ones and for a complete list of the actions in SharePoint2013, you can check the MSDN.

  1. Call HTTP web service: This action enable no-code web service calls from inside a workflow. Organisation can utilize this action to have a better management of integrating external processing with workflow. As business analyst can model the actual business process inside workflow while developer can expose the external processing logic via web services.
  2. Loop: The ability to loop through a collection is missing in SharePoint2010 and having this capability will align SharePoint processing logic with what is expected from a workflow engine.
  3. Dynamic value / Dictionary type: These terms refer to the same data type, dynamic value is used in Visual Studio while dictionary type is used in SharePoint Designer. This new data type used in conjunction with HTTP web service request make it much easier to consume web services from within the workflow.
  4. Start SharePoint2010 workflow.
    There is full interoperability in SharePoint 2013 with SharePoint 2010 workflows, which is enabled by using the Workflow interop bridge.

4. Cloud ready

There is 100 percent parity in SharePoint 2013 between on-premises and Office 365 -based workflows as shown in the picture below; therefore you can easily move an on-premises workflow to the cloud. Office 365 has already got the Windows Azure Workflow installed and configured properly. You do not have to do anything if you’d like to take advantage of the new workflow capability in the Office 365.


                Office365 Architecture

As you can see, Microsoft made a big investment in SharePoint2013 workflow and these changes make the SharePoint2013 workflow more robust, easier to build and provide more capabilities to help you to streamline your business processes. We are looking forward to helping your business take advantage of these new capabilities.

References:

http://technet.microsoft.com/en-us/library/jj219638%28v=office.15%29.aspx

http://msdn.microsoft.com/en-us/library/jj163181%28v=office.15%29.aspx

http://geekswithblogs.net/KunaalKapoor/archive/2012/08/14/sharepoint-2013-ndash-workflows.aspx

http://msdn.microsoft.com/en-us/library/jj163177%28v=office.15%29.aspx

http://msdn.microsoft.com/en-us/library/jj163091%28v=office.15%29.aspx

http://msdn.microsoft.com/en-us/library/jj163181(v=office.15).aspx

http://msdn.microsoft.com/en-us/library/jj163272(v=office.15).aspx

http://www.sharepointpromag.com/article/sharepoint/sharepoint-2013-features-144003

http://weblogs.asp.net/scottgu/archive/2012/07/26/windows-azure-and-office-365.aspx

http://www.andrewconnell.com/blog/archive/2012/07.aspx

How to Fix “Error occurred in deployment step ‘Activate Features’: System.TimeoutException:”

December 4, 2012 7 comments

Problem:

When deploying a SharePoint2013 workflow using Visual Studio, I got the following Error:

Error occurred in deployment step ‘Activate Features’: System.TimeoutException: The HTTP request has timed out after 20000 milliseconds. —> System.Net.WebException: The request was aborted: The request was canceled.

at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

at Microsoft.Workflow.Client.HttpGetResponseAsyncResult`1.OnGotResponse(IAsyncResult result)

— End of inner exception stack trace —

at Microsoft.Workflow.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)

at Microsoft.Workflow.Client.Ht

Analysis:

After reading AC’s blogpost and I find out the issue is to do with the service bus. Then I found out the following services are not started


Solution:

So I start the Service Bus Gateway and Service Bus Message Broker and the problem goes away.

References:

SharePoint 2013 Workflow – Advanced Workflow Debugging with Fiddler

How to fix “’Activate Features’: System.NullReferenceException: Object reference not set to an instance of an object.” when deploying SharePoint2013 workflow

August 9, 2012 Leave a comment

Problem:

I encounter the following error when trying to deploy the SharePoint2013 workflow using visual studio 2012 and the error message itself does not really explain why it happened.

Analysis:

After I put some time to think why this could happen, I figure out it is because you either do not configure your windows Azure workflow or forgot to register your site collection with window azure workflow.

Solution:

To configure the workflow you need to check this MSDN article How to: Set up and configure SharePoint 2013 workflows

To check your site collection is registered properly with window azure workflow. Run the following PowerShell command

If it returns true, the configuration is good

Otherwise you need to run the following to configure register your site. You need to adjust your url in the following script for your environment.


Register-SPWorkflowService –SPSite "http://sp2013" –WorkflowHostUri "http://localhost:12291" –AllowOAuthHttp

References:

Start: Set up and configure SharePoint 2013 Workflow Manager