“JavaScript-only” deployment of display templates

In most articles concerning the deployment of search display templates to SharePoint the method described is to copy one of the existing html design files in the “/_catalogs/masterpage/display templates” folder and save it with a new name in the same folder. But, when deploying from Visual Studio or from a package wsp, I think a good approach is to deploy the JavaScript file only. The reason for this is that you avoid the problem of manually republishing the html file after deployment, and, if you are an experienced JavaScript developer, you can work with JavaScript only.

The steps I usually follow in my development environment is as follows:

  1. Copy a html design file for an existing display template (for example the “Item_TwoLines.html” for CSWP item display templates)
  2. Save it to the same location, but with a different name (for example “Item_MyTemplate.html”)
  3. Copy the automatically generated JavaScript file (which will have the name “Item_MyTemplate.js”)
  4. Delete the two files from the display template library in SharePoint
  5. Create an empty module in your SharePoint project in Visual Studio and give it a name and an Url as shown below
  6. Add an element for your new template as shown below
    1. Remember to set “Level” to “published” and “ReplaceContent” to “true” in order for simpler solution upgrade
    2. The property “ManagedPropertyMapping” should be set to contain the fields that you need to use in the display template. The same managed property mappings should be specified in the JavaScript also, as shown below
  7. Deploy the template and test it!


Custom e-mail content in a SingleTask activity in SharePoint 2013 Workflows

When creating a SharePoint 2013 workflow in Visual Studio 2013 you might want to assign a task to a person involved in the workflow. This can easily be done by using the built-in SingleTask activity. Here is an example of such an activity:


  Continue reading

SharePoint REST API – getting user information from list item field

If you are using the SharePoint REST API to fetch list items, you might need to present the user information in a user field of the list item. If you for example have a Task List and want to present the Assigned To field, you will need to build the REST Query in a certain way. Consider doing the following REST query:


Continue reading

Search Service Application stuck in “Paused for:External request”

If you discover that the search service application in your environment is paused (look under “administrative status” under Search Administration in Central Administration), you can first try to find the reason, and if the service is stuck, you can try to force it to resume. Typically, the administrative status could be “Paused for:External request”. If you have this issue, start SharePoint 2013 Management Shell and do the following Continue reading

Localize JavaScript files in SharePoint

In a project I was working on, I needed a way to localize strings in JavaScript files in order to support different languages in the application. The solution was designed to be a SharePoint sandboxed solution, so we could not deploy custom resx files to the file system (this article by Waldek Mastykarz explains how to use ScriptResx.ashx to be able to refer to resource strings inside JavaScript files).

In order to solve the problem, we added one JavaScript file for each language and named it res.cc-ll.js Continue reading

Enable Workflow Manager 1.0 in a SP2013 development environment


  • The Workflow Service and Service Bus can be run as the farm account, but it is recommended to use specific accounts for these services. I created the following to accounts in my Active Directory: wfService (for the workflow service) and sbService (for the service bus)
  • The installation must be done with a user that has local administration rights and the sysadmin role on the database.

Continue reading

Setting default value of person field in SharePoint 2013 with JSLink

Often, there is a need for setting a default value in a person field. In this article, we will have a look at how to set a person field value to the current logged in user. This involves using the Client People Picker with JSLink for rendering the field in the new form and using the JSOM SharePoint API to get information about the current logged in user. Continue reading