Flow: Start a flow with another flow

A flow was becoming very big and slow and this generated an undesirable situation, it also interfed with the overall duration of the process. The original flow looped through all the items of a SharePoint list and preformed several actions and manipulations, this look more than a hour. The solution was to created a flow that looped through all the items and a second flow that preformed all the actions and manipulations if required.

During the writing of this blog post there is no default action that can start another flow. But we can start a flow by using the action called HTTP (web service).

Flow being started

First we will need to create the flow that is being started. This is required because we will need the HTTP POST URL of this flow in the flow that starts a Flow. This flow will receive an id and then start on that item.

  • Create a flow with the trigger: When a HTTP request is recieved.
  • Add the action Parse JSON.
  • Add the Get Item (by ID).
  • Open the trigger action, the generated HTTP POST URL will be used in the other flow.
  • Set the Request Body JSON Schema to be able to receive an id value.
    {     "Type": "object",     "properties": {         "id": {             "type": "string"         }     },     "required": [         "id"     ] } 
  • Set the output of the trigger called body as the content (input) for the Parse JSON action.
  • Set the following schema
    {     "type": "object",     "properties": {         "id": {             "type": "string"         }     } } 
  • Set the action Get Item (by ID) to use the ID generated in the parse JSON action.
  • Now you can add all the required actions and manipulations you need to do on the item.

Flow that start a flow

When you start a flow on a item you will need to tell the flow on which item to start. In my example I am using a fixed id. In most cases you will need to created a more dynamic solution.

  • Create a flow that starts with your preferred trigger, in my example I used the manual trigger.
  • Add the HTTP action to the flow.
  • Set the method to POST.
  • Set the URI, copy it from the trigger of the flow that is being started.
  • Set the Body .
    {   "id": "60" } 

Flow: Working around the lookup column threshold limit

Microsoft Flow is a very powerful and useful tool. Flow provides reliable solutions for automating processes and supporting business solutions. Flow can synchronize, collect and create data and much more. When creating a Flow that is connected to a SharePoint List you might encounter one of the limits of Flow. In this blog post I will explain how to work with the lookup column threshold limit.

What is the lookup column threshold limit?

The lookup column threshold limit it the maximum number (12) of lookup columns you can collect using an action or trigger in Flow. When you go over this limit you will receive the following error.

“The query cannot be completed because the number of lookup columns it contains exceeds the lookup column threshold enforced by the administrator.”

The threshold limit is set by Microsoft and cannot be changed. The reason this limit exists is to make sure the performance of the Flow is up to standards. You can also encounter this limit in PowerBI, but this post only focus on Flow.

The Lookup columns are

  • Lookup
  • Managed metadata (single and multi-value)
  • People and group (single and multi-value)
  • Workflow status
  • Created by (people and group)
  • Modified by (people and group)

Working around the limit

When using an action to collect data from a SharePoint list you can limit the gathered columns by selecting a view in the action.

  • Add the Get Items action.
  • Click on Show advanced options.
  • Select the view with the required columns (less than 12 lookup columns).
  • For certain SharePoint triggers you can also do this.

SharePoint Online: Custom Search Refiner Display Templates

The Refinement Panel is a solid part of almost every classic search solution. In most cases we can configure the selected refiner perfectly by changing the settings, but not always. Fortunately we are also able to change the display template per selected refiner and create our own custom Refiner Display Templates. In this example I created a custom display template with the following customizations.

  • Removed the first two characters of the filter option.
  • Made the refinement panel wider.

More information about display templates in general can be found on MSDN Display Templates.

Create a custom Refinement display template

First we need to make a copy of the default refinement display template, the name of the display template is Filter_Default.

  • Navigate to the filter display templates: Master Page Gallery / Display Templates / Filters.
    (http://your-site/_catalogs/masterpage/Display Templates/Filters)
  • Copy the HTML file Filter_Default and give it a new name for example: Filter_Custom.html
  • Remember not to copy the JS file, this will be created automatically.
  • Update the Title field of the display template.
  • Open Filter_Custom.html in your favorite editor.
  • Remove the code which is not needed.
    • I removed rows 33-201 and 209-229
    • Note that this might be different for you

Solution for removing characters

  • Find the following code.
    <div id='Container'>
    
  • Find the following div located below the previous one.
    <div id='Value' name='Item'>
  • Between these divs add the if statement that shortens the shown filter options.
  • Note that is does not remove the show all items feature.
  • In my example I remove the first 2 characters.
    var refinementNameShorter=refinementName;
    
    if(refinementName!="All")
    {
        refinementNameShorter = refinementName.substring(2);
        refinementNameShorter = refinementNameShorter.substring(0, refinementNameShorter.indexOf("|"))
    }
    

Solution for wider refinement panel

  • Find the following code.
    <div id='Container'>
    
  • Inside this div is the following div located.
    <div id='Value' name='Item'>
    
  • Change this into the following code.
    <div id='Value' name='Item' style="width: 500px;">
    

Configure the refinement panel

  • Open the page with the refinement panel
  • Select by Display template the newly created Filter_Custom

Code result

SharePoint: why you cannot Save Site as template

There are two reasons why you might not be able to save a site as a template. In this post I will explain what the reasons are and how you can figure out what is causing your problem. The first reasons is that the publishing feature is activated and the second reason is that custom scripts are not allowed.

1. Publishing  features activated

The most common issues is that the publishing feature is activated on the site or on a parent site. If you are trying to make a template of a subsite this will not work when the parent site has an active publishing feature.

  1. Open the site settings
  2. Click on Manage site features
  3. Check if the publishing feature is active
  4. Do this also for possible parent sites

‘Solution’ for subsite without Publishing active

I have never run into problems when using this method for subsites. However be careful it is not supported by Microsoft for a reason.

  1. Create the following URL for you specific site
  2. [SiteURL]/_layouts/savetmpl.aspx
    or
    [SiteURL]/_layouts/15/savetmpl.aspx

Truely not supported ‘solution’ when publishing is active

I don’t recommend using this so called solution, you can run into all kinds of issues. I do however want to mention this because you can find this all over the internet being claimed as an actual solution.

  1. Create the following URL for you specific site
  2. [SiteURL]/_layouts/savetmpl.aspx
    or
    [SiteURL]/_layouts/15/savetmpl.aspx

Second truely not supported ‘solution’ when publishing is active

I also don’t recommend using this so called solution, you can run into all kinds of issues. I do however also want to mention this because you can find this all over the internet being claimed as an actual solution.

  1. Open the site settings
  2. Click on Manage site features
  3. Deactivate the Publishing feature
  4. Create the following URL for you specific site
  5. [SiteURL]/_layouts/savetmpl.aspx
    or
    [SiteURL]/_layouts/15/savetmpl.aspx

2. Custom Scripts are not allowed

If publishing is not activated, it is possible that custom scripting is not allowed on the tenant level. You can see in the SharePoint Admin Center if its allowed or not. If you don’t have permission to do this you can also check it by using the following method.

  1. Open the site settings
  2. Click on Manage site features
  3. Do you see the following options? Then custom scripts are not allowed.
  4. Do you see the following options? Then custom scripts are allowed.

Solution to allow for custom scripts

  1. Open the SharePoint Admin Center in the Office 365 Admin Center

  2. Click on Settings and go to the Custom Script section.
  3. Choose “Allow users to run custom script” for Allow users to run custom script on personal sites and Allow users to run custom script on self-service created sites
  4. Click OK.
  5. It might take up to 24 hours before you can now save the site as an template.

SharePoint: Add a web part to a page layout

When customizing SharePoint we often create our own page layouts for solutions like news, events or information pages. In some cases I add a web part to the page layout. Adding web parts to a page layout when you use your own editor (not SharePoint Designer) can be a bit difficult if you don’t know all the coding details. To make live a bit more easy I use the following steps.

Solution

The solution consist of two parts creating the required web part and adding it to a page layout, three if you us another editor than SharePoint Designer.

Creating the web part

  • Add the required web part to a test page
  • Configure the web part as required
  • Export the web part to your local computer
  • Upload the web part into the web part (galery), located on the site collection settings

Page layout

  • Open SharePoint Designer and open the site collection where you uploaded the web part
  • Create a new page layout or edit an existing page layout
  • Go to the location where you want to add the web part
  • Click on Insert, then web parts and select the required web part

Another editor

  • Open the page layout in your editor
  • Copy the web part code from SharePoint Designer and paste it into your editor of choice

SharePoint Online: Managed Properties User information not available

During the development of a reporting solution that depends heavily on search, I encountered an issue with the crawled and managed properties on SharePoint Online.
The problem was narrowed down to two issues.

  • Not all the fields where showing up as crawled properties.
  • The crawled/mapped property for the user fields only contains the display name.

When a user field is added normally there are multiple crawled properties that will appear, the ows_[field name] and the ows_q_USER_[field name]. Only the ows_[field name] was showing up.
The ows_[field name] only contains the display name, but I needed the display name and e-mail. The the ows_q_USER_[field name] was required, which contains all the available user information. Both issues were resolved using by following the steps below.

Solution: User field

  1. Make sure the field is added to an item and contains a value, otherwise it will not be crawled.
  2. Determine the required managed property type, for a people field that is a string.
  3. Add the crawled property to a preset managed property, the name will be similar to ows_[field name].
  4. Map ows_[field name] to  RefinableString00.
  5. After about 15 minutes more crawled and managed properties will be available.
  6. For an user field we need the crawled property ows_q_USER_[field name].
  7. Connect this crawled property to a new mapped property or use the one that was automatically created.
  8. I recommend not to remove the mapping of the crawled property (ows_[field name]) to the preset managed property. In some cases, this causes the problem to reappear.

Solution: No crawled property availible

This solution works a little bit different.

  1. Determine the required managed property type, for a text field that is a string.
  2. Make sure the field is added to an item and contains a value, otherwise it will not be crawled.
  3. Force a reindex.
  4. Go to the advanced settings of the list or library
  5. Reindex the list
  6. Wait 15-30 minutes and see if the field has been crawled, the name will be similar to ows_[field name].
  7. If this did not work try the following steps.
  8. Add a (random) text field to a preset managed property, for example to RefinableString01.
  9. Wait 15-30 minutes and see if your field has been crawled, the name will be similar to ows_[field name].
  10. If so add the crawled property to your custom managed property.
  11. So far, these steps have always fixed my missing properties problem.