PowerApps form in SharePoint – show values of Created and Created By before item submission

I am huge advocate of using as few columns as possible when building PowerApps forms in SharePoint. Let’s take a look at a very simplified example – a custom Requests SharePoint list. 

It surely has to have fields like:

  • Requested By (a user name here)
  • Requested On (a date and time here).

So rather than creating two more columns and populating them with values, I would highly recommend using columns that already exist in SharePoint – Created and Created By. The downside of these columns is they don’t have values until a user submits the request. Because of this it might be not the cleanest user experience if you decide to use and show those fields.

There is a simple way to prepopulate those fields with values that will be exact (user name) or very close (date and time) to the ones that will appear after submission.

Let’s create a list and a PowerApps form with Title, Created, and Created By fields added to the form. This is how it looks:

To show the current date and time adjust the Text property of the Text Input control for the Created data card:

If(
    IsBlank(ThisItem.ID),
    Now(),
    Parent.Default
)

If you try to do the same trick with Created By data card you will get an error message stating it’s not possible to do that:

To work around that error you should create a label inside Created By data card. Then make it the same size, formatting, position as the control that shows a user name after submission. So you 100% overlap them.

We need to show that very label when a request is being filled out, so the Visible value should be:

If(
    IsBlank(ThisItem.ID),
    true,
    false
)

At the same time when the request is being filled out, we hide the Text Input control. The Visible value is:

If(
    IsBlank(ThisItem.ID),
    false,
    true
)

For the Label to show a current user first we need to add an Office 365 Users connector. Second, the Text property of the Label should be:

If(
    IsBlank(ThisItem.ID),
    Office365Users.MyProfile().DisplayName
)

RESULT

If you would like to make those fields look even more appealing, you may change the label of the Created By column to something like Being Created By when your request form is being filled out.

Leave a Reply