|
| 1 | +--- |
| 2 | +title: Customize a form for a SharePoint list |
| 3 | +description: Customize a form for a SharePoint list |
| 4 | +ms.date: 06/03/2020 |
| 5 | +ms.prod: sharepoint |
| 6 | +localization_priority: Priority |
| 7 | +--- |
| 8 | + |
| 9 | +# Customize a form for a SharePoint list |
| 10 | + |
| 11 | +Using Power Apps, you can easily customize a form for a SharePoint list that works best for your team or organization. |
| 12 | + |
| 13 | +In this tutorial, you will create a custom form with a user profile photo, a read-only field, and a conditionally-visible field. |
| 14 | + |
| 15 | +## Required setup |
| 16 | + |
| 17 | +Before starting, make sure your SharePoint site is set up with the [required lists and libraries](https://docs.microsoft.com/sharepoint/dev/business-apps/get-started/set-up-sharepoint-site-lists-libraries). |
| 18 | + |
| 19 | +## Create a custom form |
| 20 | + |
| 21 | +1. In your SharePoint site, browse to the **Projects** list. |
| 22 | + |
| 23 | +1. To create and manage flows for a list or a library, from the command bar, on the list or library page, select **Power Apps**. More options appear: |
| 24 | + |
| 25 | + - Create an app |
| 26 | + - See all apps |
| 27 | + - Customize forms |
| 28 | + |
| 29 | +  |
| 30 | + |
| 31 | +1. Select **Customize forms**. The Power Apps studio appears and loads your form onto the canvas. If the **Welcome to Power Apps Studio** dialog box opens, select **Skip**. |
| 32 | + |
| 33 | +  |
| 34 | + |
| 35 | +### Add a user profile photo |
| 36 | + |
| 37 | +1. On the **Insert** tab, select **Media** > **Image**. An [Image](https://docs.microsoft.com/powerapps/maker/canvas-apps/controls/control-image) control named **Image1** is added to the canvas and to the [Tree view](https://docs.microsoft.com/powerapps/maker/model-driven-apps/using-tree-view-on-form) on the left-hand panel. |
| 38 | + |
| 39 | +  |
| 40 | + |
| 41 | +1. To customize the appearance of the image, you can set its properties. |
| 42 | + |
| 43 | + 1. When you select a control on the canvas, on the right-hand panel, the **Properties** pane associated with the control appears. |
| 44 | + |
| 45 | +  |
| 46 | + |
| 47 | + 1. Because the image is the profile photo of the owner of the selected item, we recommend you make it the same height as the **Owner_DataCard1** [data card](https://docs.microsoft.com/powerapps/maker/canvas-apps/working-with-cards). |
| 48 | + |
| 49 | + 1. With **Image1** selected, in the [formula bar](https://docs.microsoft.com/powerapps/maker/canvas-apps/working-with-formulas), change the property to **Height**, and enter `Owner_DataCard1.Height` as the formula. **Image1** now has the same height as **Owner_DataCard1**. |
| 50 | + |
| 51 | +  |
| 52 | + |
| 53 | +1. Set the width of **Image1** to be the same as its height. In the formula bar, change the property to **Width**, and enter `Self.Height` as the formula. |
| 54 | + |
| 55 | +  |
| 56 | + |
| 57 | +1. Make **Image1** into a circle. In the **Properties** pane, enter a value that is half the height value in the **Border radius** property. |
| 58 | + |
| 59 | +1. Place **Image1** on the canvas in your desired ___location. Adjust the widths and heights of other controls or data cards so they do not overlap with **Image1**. |
| 60 | + |
| 61 | +  |
| 62 | + |
| 63 | +1. To change the image of **Image1** from the sample image to the owner's profile photo, make sure you select **Image1**. In the formula bar, change the property to **Image**, and enter `SharePointIntegration.Selected.Owner.Picture` as the formula. The user photo from the owner's Microsoft 365 user profile appears in **Image1**. |
| 64 | + |
| 65 | +  |
| 66 | + |
| 67 | +### Set a field to be view-only |
| 68 | + |
| 69 | +To make the **Title** field view-only, follow these steps. |
| 70 | + |
| 71 | + > [!NOTE] |
| 72 | + > **Title** is a [predefined card](https://docs.microsoft.com/powerapps/maker/canvas-apps/controls/control-card), so it is locked by default, and needs to be unlocked. |
| 73 | +
|
| 74 | +1. Select **Title_DataCard1**, toggle the **Properties** pane to the **Advanced** pane, and select **Unlock to manage properties**. |
| 75 | + |
| 76 | +  |
| 77 | + |
| 78 | + Alternatively, in the Tree view, right-click **Title_DataCard1**, and select **Unlock**. |
| 79 | + |
| 80 | +1. Toggle back to the **Properties** pane, and select the **Display mode** field. The formula bar updates to display this property. |
| 81 | + |
| 82 | +  |
| 83 | + |
| 84 | +1. In the formula bar, enter `DisplayMode.View` as the formula. |
| 85 | + |
| 86 | +  |
| 87 | + |
| 88 | + Alternatively, in the **Properties** pane, set the value of **Display** mode to **View**. |
| 89 | + |
| 90 | + **DataCardValue1** is now a view-only field. |
| 91 | + |
| 92 | +### Set the visibility of a field based on a condition |
| 93 | + |
| 94 | +To hide the **Attachments** field if the project owner is Nestor Wilke, follow these steps. |
| 95 | + |
| 96 | +> [!NOTE] |
| 97 | +> **Attachments** is a [predefined card](https://docs.microsoft.com/powerapps/maker/canvas-apps/controls/control-card), so it is locked by default, and needs to be unlocked. |
| 98 | +
|
| 99 | +1. Select **Attachments**, toggle the **Properties** pane to the **Advanced** pane, and select **Unlock to manage properties**. |
| 100 | + |
| 101 | +  |
| 102 | + |
| 103 | + Alternatively, in the Tree view, right-click **Attachments_DataCard1**, and select **Unlock**. |
| 104 | + |
| 105 | +1. Toggle back to the **Properties** pane, and select the **Visible** field. The formula bar updates to display this property. |
| 106 | + |
| 107 | +  |
| 108 | + |
| 109 | +1. In the formula bar, enter the following formula: `If(SharePointIntegration.Selected.Owner.DisplayName = "Nestor Wilke", false)` |
| 110 | + |
| 111 | +  |
| 112 | + |
| 113 | + The **Attachments** data card is now hidden if the project owner is Nestor Wilke. |
| 114 | + |
| 115 | + You can write the same conditional logic in multiple ways. For more info, see [Operators and Identifiers in Power Apps](https://docs.microsoft.com/powerapps/maker/canvas-apps/functions/operators). |
| 116 | + |
| 117 | +## Publish your custom form |
| 118 | + |
| 119 | +1. On the **File** tab, select the **Save** tab, and then select **Save**. |
| 120 | + |
| 121 | +  |
| 122 | + |
| 123 | + Alternatively, to save your app, press **Ctrl+S** while the canvas is visible. |
| 124 | + |
| 125 | +1. After you save the app, select **Publish to SharePoint**. |
| 126 | + |
| 127 | +  |
| 128 | + |
| 129 | + In the dialog box that appears, to confirm, select **Publish to SharePoint**. |
| 130 | + |
| 131 | + The version of the custom form that appears in SharePoint is the most recently published version. |
| 132 | + |
| 133 | +1. In SharePoint, verify the intended functionality of your app. |
| 134 | + |
| 135 | +## Next steps |
| 136 | + |
| 137 | +Congratulations on creating your custom form. |
| 138 | + |
| 139 | +In the next topic, we will build on top of this custom form so that the user profile photo and the visibility of the **Attachments** data card automatically update when the owner is changed. |
0 commit comments