All posts tagged O365

Using Microsoft Flow to Update a Field From a Lookup Column

While planning out a new series I want to do around PowerApps and Flow I realized one of the things I needed to do was get the value of a lookup field into a text field.  Now we all know that using a calculated field for this isn’t going to work since they can’t see lookup fields.  Yes I could use a choice field instead, but in this case I wanted a lookup field so that the users could easily update the choices from the lookup list.  There are a number of examples of doing this with a SharePoint Designer Workflow.  So I got thinking, but about Flow?  I found a number of examples of users asking for ways to do this or having problems doing it, but nothing really concrete.  So I decided to write something up quick as it really is very easy to do with flow.

Read more

Best Practices in Waiting for a Value to Change in a SharePoint Designer Workflow

Back in October I did an overview of the different ways to wait for a change in a SharePoint Workflow.  You also have the option to wait for a certain time, there are two options which are waiting for a set duration or waiting until a set date.  Either of which are easy to control or set.  I am not focusing on these actions in this post, but just a quick note if you want the date to be dynamic when using wait until a date, then you will have to set the date you want in a workflow variable prior to setting the wait value.  Otherwise your date is going to have to be static and that’s probably not going to work for you in 99% of your workflows.

Today, however I want to discuss waiting for a value to change on the list your workflow is attached to.

Bit of a disclaimer: Why am I still talking about SharePoint Designer?  Why not Microsoft Flow?  Don’t worry, I have some Flow blogs planned.  However, Designer is still widely used and will be for some time.  I encourage others to use flow where they can, but remember that not everyone has access to that yet.  Designer is free and anyone with a SharePoint environment can make use of it.  Hence, I still see providing insight and knowledge on this product very important.

I have a bit of a TLDR here as you may be just looking for the answer, and not WHY it is occurring.  I strongly urge you to read the whole post to understand why things are the way they are and to make you a better person ;-p, but if you are in a hurry or think I talk\write too much, just click here to find out what you need to do.

Read more

Modifying the PowerApps Display Styles Based on Field Values

By default, browsing items in a list with a PowerApp the items all look the same.  This is fine in most cases, but I want to ensure the managers viewing the items can see items that are older first.  I could do this by modifying the search parameters for the browse screen to put the oldest at the top, but I want the older ones to jump out a bit.  So right now logging in, a user is going to see this:

Modifying the PowerApps Display Styles Based on Field Values - Default View

I want to modify the view so that the text of each is a different color depending on the age of the request and also how close the request start date is from the current date.  So initially I want the colors set based on the following criteria:

  • If less than 7 days old: Green
  • If more than 7, but but less than 14: Yellow (<– Yellow on white background is hard to see)
  • If more than 14 days: Orange
  • If the current day is less than 21 days from the start date: Red

This is where conditionals come into play.  Like all programming languages, PowerApps allows you to use conditional statements to control objects.  If…then…else, switch statements, etc are all available to allow you to conditionally manipulate your environment.  In this case I want to use conditionals to control how the text will appear.

The format of an IF conditional is If(<Condition>,<then>,<else>) or If(<Condition>,<then>,<elseif condition>,<then>,….)

For example: if I wanted to use an if statement for the text color of the user’s name I would put the following formula on the color attribute:

Today() is a function similar in function to Date.Now().  So what the statement above states is if the item created date is within the last 7 days, change the color to green.  Applying the function to the above list items will give us the second item as green for the Name field:

Modifying the PowerApps Display Styles Based on Field Values - Formatting The Name

If I wanted to do show a couple of my options above I would need to use an if\elseif conditional.  So for the Green and Yellow conditional I want:

Modifying the PowerApps Display Styles Based on Field Values -  Multiple Conditionals

So that’s just two conditionals.  As you can see it could get pretty long.  I would love to say that we could move to a switch statement using something like this:

However, currently only comparisons to constants will work. For instance if you did a math calculation of “NumDaysDif = Today() – ThisItem.Created” and had a result of 5 you could then do this in your switch statement and get the result you want:

Unfortunately this is not an option currently.  So to accomplish what I want to do I need to write a long if statement.  The final statement will look something like this:

And when added to all of the fields in the Browse Gallery your result should look something like this:

Modifying the PowerApps Display Styles Based on Field Values - All Fields Updated

Pretty straight forward once you get going.


Thanks for reading!


Using SharePoint Lookup Type Fields in PowerApp Browse Screens

In my previous post I discussed how to create a new PowerApp directly from a SharePoint list.  I also indicated it had a few limitations that needed to be addressed.  One of these limitations was the default browse screen is not compatible with lookup type fields (People\Groups, Choice, Lookup, etc).  These field types are of course available in the details and edit screens, but not the browse screen.

Using SharePoint Lookup Type Fields in PowerApp Browse Screens - Bad User Experience

I can force the control to look at the field I want, but it doesn’t know how to convert the object into text.

Using SharePoint Lookup Type Fields in PowerApp Browse Screens - spUser Not Compatible

Being limited to just the text fields of the list or at least fields PowerApps knows how to treat as text (Date\Time fields) was creating a bad user experience in the forms I wanted to create. I had to come up with another way.  Using a calculated field in the SharePoint list won’t work because a calculated field can’t see those columns either.  It’s actually

Using SharePoint Lookup Type Fields in PowerApp Browse Screens

Because I want to be able to see these values on my browse screen they need to be converted to text.  The two fields I want on my browse screen that are not compatible with the view are:

  • Training Requested For – The name of the person taking the training (Person or Group field)
  • Training Requested – Title of the training course (Lookup Field)

Luckily there are formulas that can help us out here.  To display the name of the user PowerApps has the ability to call the DisplayName property of the field.

Using SharePoint Lookup Type Fields in PowerApp Browse Screens - Display Name of Person Field

To get the title of the training requested is just another property of the field.

Using SharePoint Lookup Type Fields in PowerApp Browse Screens - Displaying Lookup Field

I decided to get a bit fancier and add some text at the beginning of the value to add to the experience.  I wanted the field to read: Course Name: <“Name of the Course”>.  To do this, you simply combine two strings together (the can be variable based or static (what you typed)) inside a Concatenate function.

The final values I wanted on the form were the start date, End Date and total estimated cost.  Dates were straight forward as they are available from the drop down of the data properties.  The cost I had to get a bit fancy here too.  I wanted the cost to display as Total Estimated Cost: $XXXX.XX.  The problem now is that the Concatenate function requires strings and the TrainingCost field comes back as a numeric.  Enter in a another formula.  Text(<string>, formula) will convert a string to a formula.  The final formula looked like this:

When all was said and done I ended up with my form looking like this”


PowerApps is still pretty new, but there is a lot you can do with it.  I look forward to seeing where it will get to in the near future.


Thanks for Reading!

Creating a PowerApp from a SharePoint List

One of the recent innovations from Microsoft is the ability to integrate a PowerApp with a SharePoint list.  What this means is you no longer have to create the PowerApp separately from SharePoint and then create connections to the environment, but instead you can actually create the PowerApp from within the list itself.  What this doesn’t mean is that a PowerApp can replace the list forms for a SharePoint list.  However, in a recent post from the PowerApps team we will be getting this functionality very soon.

In this post, I am going to show you how to create a PowerApp from a custom list and show you around the PowerApp development tools a bit.  This post is actually the first in a series that I intend to use to show you the different things you can currently do with PowerApps.  I intend to integrate Microsoft Flow as well later as well.  Since this is the first post it makes sense to start with a brief explanation of the design and how to create the App.

Read more