Using PowerApps to Hide, Disable, set current date, align and format Fields in SharePoint Online Forms

Described below, few functions to modify fields in SharePoint Custom forms using PowerApps. The Columns are all created in the list but modified to add formula or text in PowerApps. Open your form in PowerApps (select Customize forms under PowerApps tab) and then continue selecting each field and modify its properties.

Set Default Date to Today’s date –

Select the Date & Time Column in your form and then set the value for property Default Date to Now().

Pre-populate Logged in user in Person & Group Field –

Please refer to my article here.

Disable a field when the form is a Newform –

Let’s say if you have an Approval Status field which needs to be disabled in NewForm.aspx. You can achieve the following by setting the Displaymode property in DefaultSelectedItems of your field.

Paste the following in DefaultSelectedItems property of Control’s DataCard (select the actual text control).

If(SharePointForm1.Mode = FormMode.New,DisplayMode.Disabled,Parent.Default)

Other options are Displaymode.Edit or Displaymode.View

If the column is a checkbox, then use below.

If(SharePointForm1.Mode = FormMode.New, false, true)

Resize Custom Form\Data Cards –

Resize Controls and DataCards: The simplest way to resize a data card is to re-size all controls in it. Expand the Datacards from the left and then check the position and height of each control in it. Look specifically at the ErrorMessage Control.

Resize and Position form on the Screen: To Resize the position of SharePointForm (or whatever your form is called), change the value of X corresponding to the position of your screen. Select the form from left and then select “X” from properties. Add the value in Fx field or in Advanced properties on right. You can center your form or align it left or right with this value.

Resize\Change Screen size: Set the Orientation of the screen if you want to decrease the screen size and add custom Width and height. For that, navigate to File -> Settings -> Screen size + orientation.

In the Orientation list, select Portrait or Landscape. Select Custom Width and Height.

Aligning List form labels: Use X and Y properties of each label and control to align and resize list form labels. I created a sample that quite resembles the Infopath form alignment. I tried to keep the control’s height, padding and X & Y values consistent. See the screen below.