SharePoint Online | Column Links to Power Apps: JSON for Prod + NonProd


The ask, suggest improvements to an earlier JSON snippet. A Power Platform maker wanted to easily navigate SharePoint Online (SPO) users to their Power Apps solution, so they opted to create a dynamic link using JSON list column formatting. The result, a clickable icon with the HREF path built using an array and the SPO list item ID passed as a parameter:

Figure 1 - SharePoint Online JSON for list column formatting.
Figure 1 – SharePoint Online JSON for list column formatting.

So, the above works, but unfortunately, because the app ( /a/ ), environment ( /e/ ), and tenant IDs were hardcoded into the array, the maker needed to create and maintain two JSON snippets; one for Prod and another for NonProd, with hardcoded IDs relative to each.

An alternative approach, they could still hardcode the IDs, but now, add a conditional expression. Using If-Then logic and special string values, determine whether or not the [$FileRef] value, which represents the SPO item path, contains any unique text for NonProd, not found in the Prod URL. Here, the maker was fortunately intentional and created the list with “NonProd” in its internal name, so when there isn’t a match, populate the Prod values and when there is a match, populate the NonProd values. This way, the maker only needs to maintain a single JSON snippet:

Figure 2 - SharePoint Online JSON for list column formatting but revised.
Figure 2 – SharePoint Online JSON for list column formatting but revised.

Conclusion:
JSON is low-code enough and flexible enough that it can easily connect SharePoint Online and the Power Platform into a fusion solution, keeping with a pseudo level of application lifecycle management.

“The civil rights situation is like a pregnancy. It will get worse, I believe, before it gets better. What the usual pregnancy comes to is a decent baby. That is what we all hope will be the end product of this stress. It is customary, at the end of a pregnancy, to have for your pains a decent baby.”

Gwendolyn Brooks

#BlackLivesMatter

Leave a comment