Create Cascading Drop Down Input Form for SharePoint with PowerApps

My Scenario:

I had the requirement to have a list input form in SharePoint online, that contains “Scope”, “Category” and a “Subcategory”.
Of course – to have it end user friendly – these dropdowns had to be cascading.

First of all: as of today, cascading dropdowns in PowerApps only works smooth with TEXT only values!! (yes, it’s a real mess)
So how to prevent the user from typing mistakes with text only fields?
–> Provide the user a lookup input interface and create the text only values with a simple Flow.

Solution:

  • First of all create the lists – 3 simple lists with Title only for the lookup values and 2 lists for mapping
  • In the mapping lists make the Title not required, add 2 lookup columns that are required and 2 additional columns for the text value
  • Create a simple Flow for each of the two mapping lists, that updates the text columns, that we’ll use later for our dropdown values
  • Then create a target list (also text only fields for these three “dropdown” columns!) Of course all other columns can be treated as standard.
  • In the main list click on “Customize Form” under PowerApps menu
  • Unlock the 3 Data Cards under “Advanced”, replace the text input controls with dropdown controls and rename them to something meaningful like
    “ddScope”, “ddCategory” and “ddSubCategory”
  • set the “UPDATE” property of the data cards to the name of the SP field to be updated with the value
  • Now modify the “Items” property of the new dropdown fields.

ddScope:
Distinct(cascMap_ScopeCat, LUScopeText)
ddCategory:
Filter(cascMap_ScopeCat, LUScopeText = ddScope.Selected.Result)
ddSubCategory:
Filter(cascMap_CatSub, LUCategoryText = ddCategory.SelectedText.Value)

(if you want to sort the values, you can put a SortByColumns() function around the filter formula)

  • Now the lookups are already working, but if you click on Save, the values are not written to SharePoint. To fix this, we have to re-add the original columns to the form. When added again, unlock them under Advanced and set the “Default” property to the value of the dropdowns.

Scope:
ddScope.Selected.Result
Category:
ddCategory.SelectedText.Value
SubCategory:
ddSubCategory.SelectedText.Value

  • Last but not least, hide those fields from the form by setting the “Visible” property to false
  • Save, publish and enjoy 😉


1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...


Using List Views, when having more than 50 views

Problem:

If you want to use an app part in SharePoint and have more than 50 different views, only the first 50 will be available to select in the web part configuration pane.

Solution:

  1. select the view on the main .aspx of the list / library (here it will also work for more than 50 views)
  2. open that .aspx page with SharePoint Designer and navigate to the view .aspx (All Files – Shared Documents – Forms – …)
  3. copy the <view>….</view> part
  4. convert that to XML encoded string (there are many free online converters available)
  5. add the list / library app part to some .aspx page and EXPORT it
  6. edit the exported file with some code editor and replace the view string with the generated one
  7. save with a new name
  8. import the modified web part file and use

have fun…!

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Using Graph in MS Flow (Bearer Token)

Problem:

I had the need to give our users a way, to register external users through the SharePoint interface for a custom solution also based on SharePoint.
It was a little bit tricky to get a token from Graph to use it in the next action.
To save your time, I document it here…

Solution:

  1. register an app on https://apps.dev.microsoft.com/
    make sure, you grant the application appropriate permissions in Azure AD. In my case it was “User.ReadWriteAll” (application permission!)
    then generate a password and also note down the application ID (you need it later);
    in Azure AD grant the application the admin consent for the permissions!
  2. In Flow add an action “HTTP Request”
    Note that the body content must be URL encoded
  3. Now you have to get the token out of the response;
    use the action Initialize Variable and a custom expression
    (where ‘GetAccessToken’ is the name of the action from before!)
  4. again use an action HTTP Request to do the POST

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

MS Flow – Calculating DateTime Difference

Problem:

I needed something like calcDateTimeDiff formula, but wasn’t available in Flow.  The data source in my case was a SharePoint list and I wanted to write the time difference (daily work time) back to the list in a string column.

Solution:

1. calculate the datetime difference in ticks() format – yes, that’s the trick!
One tick = 1 nanosecond
sub(ticks(item()[‘stEnd’]),ticks(item()[‘dtStart’]))

2.  Starting the day at 00:00 and add the seconds, then define the output format (1 second = 10.000.000 ns)
addSeconds(’00:00:00′,int(div(int(variables(‘testDiffDate’)),10000000)),’HH:mm:ss’)

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...