Power Apps Functions: Working With User(), Today() and Now()


In this tutorial, we’re going to talk about three Power Apps functions that can make a huge difference in the way end-users view and utilize your app — the User(), Today() and Now() functions.

If you followed our other tutorials about Power Apps, then you probably know how to make your own app and how to publish it by now. The beauty of this platform is its ease of use even for those who have little coding or app development background.

But creating an app means thinking about the convenience of the end user as well. That’s the beauty of the three Power Apps functions that we’ll be discussing today.

The User() Function

The User() function returns a piece of information about the app’s current user.

This function introduces so many possibilities in terms of customization, especially if you have multiple people using your app.

To show you how the User() function works, let’s add a label, then let’s choose the text property under the properties dropdown.

power apps functionspower apps functions

Then, type in User() and add a dot to see what options we have.

As you can see, the User() function can return three things — the user’s email, their full name, and their image. So if we type in User().Email, the user’s email address pops up on the label we created.

power apps functionspower apps functions

If we try User().FullName, it then returns Henry Legge.

This gives us so many options in terms of personalizing the app depending on who’s using it.

For example, we can have a welcome message that uses the actual name of the user on the home page. If you want more advanced customizations, it’s also possible to use this function to dictate certain settings based on the user’s preferences.

For now, let’s take a look at how we can use this function to create a personalized welcome message. Let’s proceed to our home screen.

power apps functionspower apps functions

We’re going to start off by adding a label here on top and customizing the color to white so that it aligns with the rest of the theme.

Since we’re going to join different strings in this formula, we’re going to use the Concatenate function.

power apps functionspower apps functions

Then, we’ll add the text “Welcome” and reference the user’s full name. Once we hit the Enter key, you’ll see that the label now says “Welcome Henry Legge”.

Because we referenced the user, this means that the name changes depending on who’s logged in.

The Now() and Today() Functions

Let’s move on to the next function we’re going to discuss, which is the Now() function.

The Now() function returns the current date and time value.

Let’s go to our master screen and add a label. Then, let’s use the Now() function. As you can see, the label shows the current date and a timestamp.

power apps functionspower apps functions

This timestamp changes depending on your timezone. This means that even if you have app users in other places around the globe, it will always show their current date and time, and not yours.

This function also offers so many possibilities in terms of personalization. For example, you can make some of the app’s features available only at certain times in a day. You can also set a personalized message at a specific hour.

In contrast, the Today() function only returns today’s date.

So if we copy the label but put in Today() instead, we can see the difference between the two.

Choosing between the Now() and Today() function is more of a preference, so it’s up to you what you think would best serve your end user. You can also think about other capabilities that you want your app to have and choose the function that you think will fit best.

Now, let’s go back to the home page. Let’s say we want to keep things simple and don’t really mind not having the time displayed here. So let’s create a new label that uses the Today() function.

power apps functionspower apps functions

***** Related Links *****
Power Apps Introduction: Definition, Features, Functions And Importance
Power Apps Environments: Setting Up The App Elements Properly
PowerApps Functions and Formulas | An Introduction

Conclusion

What we’ve covered in this tutorial are just the basics. But as mentioned earlier, these three Power Apps functions could lead to an endless number of customizations that could enhance the user experience.

As you work on your app, think about ways on how the specific user can have their own preferences applied, or how the date and time could impact the way things work. The more creative you are with these solutions, the more that your users will enjoy the app you worked on.

All the best,

Henry

 

author avatarauthor avatar

Henry Habib is an accomplished Power Platform and Office 365 trainer, with over 100 hours of recorded content and over 30,000 paid students on e-learning platforms.



Source link

Be the first to comment

Leave a Reply

Your email address will not be published.


*