Wednesday, May 10, 2017

Microsoft Flow – Getting your SharePoint field values

When using Microsoft Flow to trigger on SharePoint list items I often use the Initialize variable actions to get the values of my fields. You could of course use Dynamic content at any stage of your flow, but when you play around with the initialize variables you will find some maybe unexpected behaviours.
First of all I created a SharePoint list with one field for each field type.

Then I created a flow with a that initializes multiple variables.

Yes/No

Then the first field that I looked at Yes/No shows quite nicely the way the Dynamic content behaves:
As you will have noticed my Yes/No field from my trigger is available as are all the other Boolean type fields from my trigger. This depends on the Type selected in my initialize action.

Number

Then I tried the Number field and I found that the expected Integer type didn’t offer me the Number field that I created on the list. I had to select Float as my type before I could set a variable to my number value.

Person

Then the next field. A Person field gives you an even more unexpected behaviour. When you select the String type you get multiple parts of the Person field presented as data:
The following data is available to use:
  • Person Claims
  • Person Department
  • Person DisplayName
  • Person Email
  • Person JobTitle
  • Person Picture
But don’t forget that you have ore options. When you select the Object type you will get also a Person object:
Note: The object dynamic content only displays the above ones you have selected String as a type and the inputs have been loaded. This seems to be a minor bug where selecting Object initially doesn’t load the data properly.
When running the flow you will find that the same data is returned in an object format as Dynamic contents already offers you:
Did you notice the value-key-item-output Dynamic content earlier? This is probably the right place to have a look at that one as well. When loading this into an Object variable you will find a complete json representation of you trigger item. So once you understand how to query json in flow you can create your Expression based conditions quite quickly.

{
  “@odata.etag“\”2\””,
  “ItemInternalId”“1”,
  “ID”1,
  “Title”“Title”,
  “MultipleLinesOfText”
B81BCC989\”>This is some gb(180, 85, 0);\”>formatted textms-rterangecursor-start\”>rangecursor-end\”>
,
  “Number”1234,
  “YesNo”true,
  “Person”: {
    “@odata.type“#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser”,
    “Claims”“i:0#.f|membership|pieter@pieterveenstratriaddev.onmicrosoft.com,
    “DisplayName”“Pieter Veenstra”,
    “Email”“pieter@PieterVeenstraTriadDev.onmicrosoft.com,
    “Picture”https://pieterveenstratriaddev.sharepoint.com/_layouts/15/UserPhoto.aspx?Size=L&AccountName=pieter@PieterVeenstraTriadDev.onmicrosoft.com,
    “Department”null,
    “JobTitle”null
  },
  “Person#Claims”“i:0#.f|membership|pieter@pieterveenstratriaddev.onmicrosoft.com,
  “Modified”“2018-04-20T10:34:04Z”,
  “Created”“2018-04-20T10:34:01Z”,
  “Author”: {
    “@odata.type“#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser”,
    “Claims”“i:0#.f|membership|pieter@pieterveenstratriaddev.onmicrosoft.com,
    “DisplayName”“Pieter Veenstra”,
    “Email”“pieter@PieterVeenstraTriadDev.onmicrosoft.com,
    “Picture”https://pieterveenstratriaddev.sharepoint.com/_layouts/15/UserPhoto.aspx?Size=L&AccountName=pieter@PieterVeenstraTriadDev.onmicrosoft.com,
    “Department”null,
    “JobTitle”null
  },
  “Author#Claims”“i:0#.f|membership|pieter@pieterveenstratriaddev.onmicrosoft.com,
  “Editor”: {
    “@odata.type“#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser”,
    “Claims”“i:0#.f|membership|pieter@pieterveenstratriaddev.onmicrosoft.com,
    “DisplayName”“Pieter Veenstra”,
    “Email”“pieter@PieterVeenstraTriadDev.onmicrosoft.com,
    “Picture”https://pieterveenstratriaddev.sharepoint.com/_layouts/15/UserPhoto.aspx?Size=L&AccountName=pieter@PieterVeenstraTriadDev.onmicrosoft.com,
    “Department”null,
    “JobTitle”null
  },
  “Editor#Claims”“i:0#.f|membership|pieter@pieterveenstratriaddev.onmicrosoft.com,
  “{Identifier}”“Lists%252fAllSorts%252f1_.000”,
  “{Link}”https://pieterveenstratriaddev.sharepoint.com/_layouts/15/listform.aspx?PageType=4&ListId=8317c539-1506-4a32-a84e-447bed9e22f4&ID=1&ContentTypeID=0x01008F2ED88AA63A6640A64719BF65EBF976″,
  “{Name}”“Title”,
  “{FilenameWithExtension}”“Title”,
  “{Path}”“Lists/AllSorts/”,
  “{HasAttachments}”true
}

Date

Then now the next type of field. The Date field is another strange one. The Initialize Variable only offers Boolean, Integer, Float, String, Object or Array. What do I do with my Date?
The String type offers me the Date.

Choice

The choice field is another one where the Dynamic content help you getting to the actual data.

Lookup

The lookup fields are always causing problems when coding SharePoint fields. Time to put flow to the test
In my example I’m creating a lookup to the list that I’m testing all the fields with. Additionally I’m making multiple fields available within my views on the list.
We could just go for the techy option here using a string variable and set it to the following Expression:
@triggerBody()?[‘Lookup_x003a_Date’]?[‘Value’]
But there is an easy way just select the Dynamic content again after you selected the String as the variable Type

Conclusions

The different type of fields in SharePoint can all be handled. I found a few times that as I added list columns that Flow didn’t pick up the changes until I closed and opened my flow again. This can be a real pain. Also when you can’t find the data that you are looking for the json queries can help you find the data that you want. Worst case switch over to the Object variable type just to help you understand the data structure that is returned.

Tuesday, April 18, 2017

POWERAPPS: DYNAMIC SORTING BY COLUMN HEADERS

In PowerApps, galleries and tables do not automatically have any sort settings by default.  This is something that needs to be built.  In this post, I’ll explain the different aspects involved in building this solution where you can click each column heading to sort by that column, and when you hover over each column heading, that heading and sort icon lights up, as seen below with the project name column:
powerapps-sort-columns
In this example, I use a local variable called varSortPriority.  Each time I click a column heading, it is going to change the variable, and the gallery is sorted by that varSortPriority variable.  I also have a variable called SortDescending, which I will be able to toggle back and forth between ascending and descending.
In this example, my data source is called Projects.  So for the Items property of this gallery, I set it to the following:
SortByColumns(Projects,varSortPriority,If(SortDescending,Ascending,Descending))
This says to sort the gallery by the varSortPriority, and if the SortDescending variable exists, then sort by ascending, otherwise sort it in a descending order.
I inserted labels above the gallery in that medium shade of purple that you see.  The labels themselves don’t have any special properties.  I inserted a Arrows Up Down icon right on top of each of these labels, which is where the logic happens.
First of all, I named my column header labels appropriately.  I’ll use the project name as an example here, I called it lblProjCol
Then, here are the properties that I set up for the sort icon that I placed on top, which I called icoSrtProj. (All of the column headers do have a sort icon, I just set it up so that it only turns that lighter purple color when you hover over it.)
PropertyValueDescription
OnSelectUpdateContext({varSortPriority:”Title”,
SortDescending:
!SortDescending})
Title is the name of this column in SharePoint, even though I renamed it to Project Name later.  The exclamation mark in front of the SortDescending is what makes it toggle back and forth between ascending and descending each time you click on it.
ColoricoSrtProj.FillColor is the same as fill, so it’s invisible by default.
HoverFillRGBA(255, 255, 255, .5)“lights up” when you hover over it
XlblProjCol.Xsame X axis as the project column label
YlblProjCol.Ysame Y axis as the project column label, so that it sits directly on top of it.
WidthlblProjCol.Width
HeightlblProjCol.Height
PaddingLefticoSrtProj.Width-40This sets the icon to have a lot of padding on the left, which makes it cover up the column header wording.  This is important in making the clickable button stretch all the way across the column header.
The same pattern is used for all of the other column header labels, putting an icon on top of each one, and setting the icon’s properties in relation to the label, and setting the sort priority to that column’s name in SharePoint.  For example, the status column’s OnSelect is:
UpdateContext({varSortPriority:”Project_x0020_Status”,SortDescending: !SortDescending})

Monday, March 6, 2017

New Updates for the SharePoint Mobile app

SharePoint app for Android and iOS has been around for quite some time already. This app is often dubbed as ‘intranet in your pocket’ and those who are running on SharePoint / Office365 probably might agree with this fact. Microsoft keeps on consistently improving the capabilities and user experience based on the feedback from its user base.
The recent update of the App gives you access to the new releases that Microsoft has released like Hub Sites, Team Sites etc. The latest version allows you to keep you informed with the comments from news articles that are published. You can always stay updated on every happening in your organization.

Navigate SharePoint Hub Sites on your Mobile

Microsoft released SharePoint Hub Sites somewhere around March this year, and now even before end of April SharePoint mobile app has been updated with full access to Hub Sites and all its associated sites through your mobile. Surely, a sign that Microsoft is serious on improvising SharePoint features. You will now get full cross-site navigation, have a view of the aggregated activities, news, files and lists etc. Hub Sites can help you stay organized.
Navigate SharePoint Hub Sites on your MobileCross-site navigation of a SharePoint hub site (left), and Teams site (on the right).

Team Site Homepages access

Now, in your mobile app, all the content, web parts, layout choices show up like any page or news when viewed on smaller devices. The SharePoint mobile app for Android, you can access your activity, news, files etc. from within a new team site navigation menu. Both the mobile and web are more fluid and easier for you to work across both the systems.

Notification alerts for comments

Whenever you get a comment on your news article you get a notification on your mobile app. That makes it easy and lively for you to take part in the discussion. A real engagement that could improve workplace effectiveness.
Comment Notifications on your mobile.
Comment Notifications on your mobile.

Tab Layout for Android.

It is often the case that Android mobile apps doesn’t stretch to accommodate for a Tab screen. Microsoft has a new App for Android tab layout. You will now be able to see your personalized news, sites, links, people etc. at the bottom of your screen making it easy for you to access any of those whenever you need them.

Summary of SharePoint mobile updates

Feel free to check the links below for updated news on Mobile app developments for different platforms.
What we have discussed above are the most recent additions to the SharePoint mobile apps. If you are following every update closely, you might appreciate the fact that Microsoft is consistently bringing in new features and refining the overall mobile user experience to the next level. Hope we will get every new SharePoint feature transformed to the mobile platform too.