SharePoint Search in Office 365 – Refiner Date and Display Templates

SharePoint Search Scenario Background

Search is going to be a key part to any business management system in Office 365 and SharePoint. In this post, we mapped our crawled Expires Date property to the Managed Property named RefinableDate00. Afterwards, the refiner date was customized for the Search Results on our Sales Contracts Quick Search page. That’s shown in the first image below. Also called out in that post: for the Contract Lifecycle Management (CLM) system, the dates were not in the right format because they included a timestamp.

Business Management O365 SharePoint contracts sorted by expiry.

The first issue is with the time stamp (e.g. “07:00:00 AM”) showing up in the results. When the field Expires Date field was created, it was set to a “Date Only” field because time is irrelevant to the expiration date of these sales contracts. Also, not everybody is familiar with the design of the page, so without a label like “Expires: ” before the date/time value, a user won’t necessarily be able to determine exactly what that date represents.

In this post, we’re going to fix that date to be a standard US-English date format without a time stamp, and we’re going to get a label in the results as well.

Reviewing the Refiner Managed Property RefinableDate00

Something to note about the RefinableDate00 managed property that we created here: I also added an Alias value to the Managed Property definition so that I can refer to “RefinableDate00” as something more identifiable when its used in scenarios like the one covered herein. Later on, when I use “ExpireDateRefinable” in the Search DisplayTemplate…this is why:

Creating the new Display Template for the Contract Lifecycle (CLM) Search Results

My assumption is that you enabled the Publishing Infrastructure as we covered in this post. If you didn’t, the Master Pages gallery you’re about to see will not look the same. So, here’s what I’m going to do:

  1. Go to the Master Page gallery.
  2. Navigate into the Display Templates used for Content Search Web Parts…because the Sales Contracts Quick Search page is based on a Content Search Web Part (CSWP).
  3. Locate the Display Template used for “Two Lines”…because that’s what we chose when setting up the quick search page.
  4. Download that template.
  5. Fix it up to have a reference to the RefinableDate00 (a.k.a. ExpireDateRefinable) property so that I can use that property in my custom HTML.
  6. Write some JavaScript to manipulate and reformat that date value into what we want: an English-US date format with no time stamp.
  7. Write the custom HTML that outputs the new date how we want…with a label in front of it.


Applying the new SharePoint Search Display Template

Now, it’s time to:

  1. Upload the new Display Template.
  2. Publish the template.
  3. Reset the CSWP properties on the Contracts Quick Search page (to use our new template).
  4. Validate the results.


Of course, you can repeat this pattern to add additional important fields.

  1. Promote the crawled property to a managed property.
  2. Pull the managed property into the SharePoint Search Display Template by adding it to the ManagedPropertyMapping XML element.
  3. Pull the value from ctx.CurrentItem.
  4. Validate/manipulate that value.
  5. Output it into the Display Template.




Categories: Business, Business Management, Contract Lifecycle Management, Office 365 and O365, SharePoint

Tags: , , ,

2 replies


  1. Office 365 and SharePoint – Sales Contract Lifecycle Management (CLM) – Calendars with Search Web Parts and Calculated Event Date Filters – Westmorr Consulting
  2. Office 365 and SharePoint – Human Resources (HR) – Company Directory and People Finder with SharePoint Search and User Profiles – Westmorr Consulting

Leave a Reply

%d bloggers like this: