Posted on Leave a comment

3 alternatives to building cascading drop-downs in SharePoint – SharePoint Maven

In this article, I share three options for building cascading, menu-driven drop-downs in SharePoint Online/Office 365.

Option 3: Customize in PowerApps

OK, for the real cascading menu, you will need to use Power Apps. It is not something that you can do quickly or easily, like with the options above. You will need to get familiar with Power Apps and some minor coding. Since this falls outside of the “out of the box” solution, I would like to share the technique documented by others who are true experts in this area.

 

Source: 3 alternatives to building cascading drop-downs in SharePoint – SharePoint Maven

Posted on Leave a comment

Remove title header on SharePoint Online – SharePoint Tricks

When creating a new page a header with the title of the page will be shown to the user. In the current days, it’s not possible to remove that header from the page using the SharePoint interface. Today, we will share a PowerShell that allows you to remove that area from the page and some article that you can use with different options.

Replace the variable below with your own and you will have a page without the title header.

$PageName = "PageName"
$LoginUrl = "https://contoso.sharepoint.com/sites/siteName"

Connect-PnPOnline -Url $LoginUrl -UseWebLogin
Set-PnPClientSidePage -Identity $PageName -LayoutType Home

If you intend to remove from all the SitePages use this code, but before you do to all of the Site Pages, I would recommend making some backup. You can use the approach of this article for this.

$LoginUrl = "https://contoso.sharepoint.com/sites/siteName"
Connect-PnPOnline -Url $LoginUrl -UseWebLogin

$pages = (Get-PnPListItem -List SitePages).FieldValues
foreach($page in $pages){
    Set-PnPClientSidePage -Identity $page.FileLeafRef -LayoutType Home
}

 

Source: Remove title header on SharePoint Online – SharePoint Tricks

Posted on Leave a comment

list – How to make a filtered lookup field – SharePoint Stack Exchange

In addition to your “Deactivated” field, create a Calculated field named “ActiveTitle” (or whatever you want to call it). Use the following formula:

=IF(Deactivated,"",Title)

The ActiveTitle field will be empty when the Deactivated field is set. When you configure your lookup column, tell it to use the value from ActiveTitle instead of Title. Empty values will not show up in your lookup list, so you will end up with only the values that are not Deactivated. Let me know if you have any trouble.

Source: list – How to make a filtered lookup field – SharePoint Stack Exchange

Posted on Leave a comment

FIX: SharePoint 2013 Workflow recursion prevention – Part 2 | Microsoft Docs

FIX: SharePoint 2013 Workflow recursion prevention – Part 2

Following FIX: SharePoint 2013 Workflow recursion prevention – Part 1, this post will walk you through the processes of designing your workflow that creates a list item on another list and invokes the workflow associated with that list using the new REST APIs released through SharePoint 2013 May 2014 CU as pointed out in part 1 of this series.  If you haven’t read through part 1 of this series I suggest you do to get some background that will help you appreciate this post.

The scenario:

List1 has a workflow Workflow1 associated with it.

Workflow1 can be set to auto-start on item adding/updating or set to manually start or both, it doesn’t matter.

Source: FIX: SharePoint 2013 Workflow recursion prevention – Part 2 | Microsoft Docs

Posted on Leave a comment

SharePoint Online. Column JSON formatting

SharePoint Online. Column JSON formatting

Column formatting feature allows us to customize field rendering without using client scripts (only HTML and CSS).

Note
JSON-based column formatting available only for new experience (Modern UI). Old SharePoint UI is not supported.

Column formatting has some limitations you need to know before starting to use this feature:

The following column types are not supported yet:

  • Managed Metadata (Taxonomy)
  • Filename (in Document Libraries)
  • Calculated
  • Retention Label

Referenced field. You can use only fields that are presented in the current view. The ID field is always presented.

SharePoint Online. Column formatting is not available for on-premise SharePoint instances.

Despite the limitations, column formatting can help you to make your lists more friendly and useful. So here is a couple of samples of using column formatting:

Sample #1. Mask column value on a small screen

There are two properties which can be used to get the height and width of the window:

  • @window.innerHeight – the height of the browser window in pixels
  • @window.innerWidth – the width of the browser window in pixels

These values counted only on rendering the list and do not change on window resizing (unless the page is refreshed manually).

The following is an example of showing field value only if screen width greater than 900 pixels. Otherwise showed “…” instead of value:

{
  "elmType": "div",
  "txtContent": {
    "operator": "?",
    "operands": [
      {
        "operator": "<=",
        "operands": [
          "@window.innerWidth",
          900
        ]
      },
      "...",
      "@currentField"
    ]
  }
}

If the screen width less than 900 pixels we see dots instead of the value:

Cell value is masked on a small screen
Cell value is masked on a small screen

On a large screen we see the value:

Cell value visible on a large screen
Cell value visible on a large screen

Sample #2. Show values in one line

SharePoint list or document library view can contain columns with a large text inside. This leads to the fact that the rows in the view can be of different heights, which makes it inconvenient to work with data. With the new JSON formatting capability, it’s possible to show any column in a single-line with no wrapping.

The following formatting makes the cell value to be in a single line:

{
    "elmType": "div",
    "style": {
        "word-wrap": "initial",
        "white-space": "nowrap",
        "overflow": "hidden"
    },
    "txtContent": "@currentField"
}

Cell value with no wrapping:

Show values in a single-line
Show values in a single-line

Sample #3. Show Lookup ID if the value is empty

SharePoint Modern UI has a small gap: lookup column is empty if the field to show (Title column by default) is empty. JSON formatting allows provides us a workaround to show the ID of the lookup item in case the value is empty.

The following sample is to apply the workaround (show @currentField.lookupId if @currentField.lookupValue is empty):

{
    "elmType": "a",
    "txtContent": {
        "operator": "?",
        "operands": [
            {
                "operator": "==",
                "operands": [
                    "@currentField.lookupValue",
                    ""
                ]
            },
            "@currentField.lookupId",
            "@currentField.lookupValue"
        ]
    },
    "attributes": {
        "href": {
            "operator": "+",
            "operands": [
                "/lists/FormattedColumnsteams/DispForm.aspx?ID=",
                "@currentField.lookupId"
            ]
        },
        "target": "_blank"
    }
}

No more missing lookup links:

Show lookup id if the value is empty
Show Lookup ID if the Value is empty

Sample #4. Show user picture

People column in the modern UI has a set of properties that allows us to present the value in a rich format.

Properties of the user column which can be used in formatting:

  • id
  • title
  • email
  • sip
  • picture

You can get user profile image with a link of the following format:

/_layouts/15/userphoto.aspx?username={UserLogin}

The following is a sample to show additional user information (image, title, and email) instead of just a name:

{
    "elmType": "div",
    "children": [
        {
            "elmType": "div",
            "style": {},
            "children": [
                {
                    "elmType": "div",
                    "style": {
                        "float": "left",
                        "margin-right": "5px"
                    },
                    "children": [
                        {
                            "elmType": "img",
                            "style": {
                                "width": "32px",
                                "display": "inline-block"
                            },
                            "attributes": {
                                "src": {
                                    "operator": "+",
                                    "operands": [
                                        "/_layouts/15/userphoto.aspx?username=",
                                        "@currentField.email"
                                    ]
                                }
                            }
                        }
                    ]
                },
                {
                    "elmType": "div",
                    "children": [
                        {
                            "elmType": "div",
                            "style": {
                                "word-wrap": "initial",
                                "white-space": "nowrap"
                            },
                            "children": [
                                {
                                    "elmType": "a",
                                    "txtContent": "@currentField.title",
                                    "attributes": {
                                        "target": "_blank",
                                        "href": {
                                            "operator": "+",
                                            "operands": [
                                                "/_layouts/15/userdisp.aspx?ID=",
                                                "@currentField.id"
                                            ]
                                        }
                                    }
                                }
                            ]
                        },
                        {
                            "elmType": "div",
                            "style": {
                                "word-wrap": "initial",
                                "white-space": "nowrap"
                            },
                            "children": [
                                {
                                    "elmType": "a",
                                    "txtContent": "@currentField.email",
                                    "attributes": {
                                        "href": {
                                            "operator": "+",
                                            "operands": [
                                                "mailto:",
                                                "@currentField.email"
                                            ]
                                        }
                                    }
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

Username is a link to delve profile and email is a link to send a message:

Source: SharePoint Online. Column JSON formatting

Posted on Leave a comment

Missing “Save Site As Template” Option in SharePoint Online, Office 365 and SharePoint Server 2013

The ability to save site as a template may be missing in SharePoint at times. This article explains why it might be missing and what your options are.

The most common reason that people notice the “Save site as template” option missing in SharePoint has to do with the enabling of SharePoint publishing feature. When you enable the SharePoint Server Publishing feature, it disables the ability to save the site as a template.

 

The Consequences of Deactivating Publishing

While it’s possible to save a publishing site as a template if you temporarily deactivate the publishing feature, it will be a huge mistake. I don’t recommend you use this workaround under any circumstances. This could be a recipe for disaster because although saving the site as a template would work fine, in the future when you try to use a template that was created by deactivating the publishing feature, you are likely to have all kinds of problems. Among other issues, you may see the following error message:

Provisioning did not succeed. Details: Failed to initialize some site properties for Web at Url: ‘……’ OriginalException: Failed to compare two elements in the array.

For all practical reasons, a template that was created by turning the publishing feature off, should be considered “infected with bugs” that are going to bug you (no pun intended) down the road. Technically they are not bugs at all, it’s just that the publishing feature contains certain site elements that a site template doesn’t support. In other words, once you enable publishing on a SharePoint site, there are components that can’t be turned off, even if you disable publishing. That’s why it’s so important that you plan your SharePoint deployment BEFORE you deploy SharePoint on your network.

WARNING! Avoid deactivating the publishing feature just so you can save the site as a template.

If you accidentally enabled publishing or community feature on a SharePoint site, you are better off saving your site content, deleting the site, and creating a new site with the appropriate template. Keep in mind, that when you delete a site, all content will be lost. You won’t be able to go to the Recycle Bin and recover your data.