Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. dennythecoder revised this gist Jan 14, 2025. 1 changed file with 28 additions and 1 deletion.
    29 changes: 28 additions & 1 deletion Power Apps - Populate Field with Current User.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,30 @@
    # Populate Field with Current User

    Requires 'Office365Users' Connector.
    Requires **'Office365Users'** Connector.

    What I'm doing here is prepopulating a field on an item form that references a people column in a SharePoint list.

    #### Named formulas

    ```javascript
    CurrentUser = Office365Users.MyProfileV2();
    CurrentUserPhoto = Office365Users.UserPhotoV2(CurrentUser.mail);
    CurrentUserObject = {
    '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
    Claims: "i:0#.f|membership|" & CurrentUser.mail,
    Department: CurrentUser.department,
    DisplayName: CurrentUser.displayName,
    Email: CurrentUser.mail,
    JobTitle: CurrentUser.jobTitle,
    Picture: CurrentUserPhoto
    };
    ```

    #### Item Form

    For the DataCardValue combobox that selects a person, under **DefaultSelectedItems**:

    ```
    If(ItemForm.Mode = FormMode.New, CurrentUserObject, Parent.Default)
    ```

  2. dennythecoder created this gist Jan 14, 2025.
    3 changes: 3 additions & 0 deletions Power Apps - Populate Field with Current User.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    # Populate Field with Current User

    Requires 'Office365Users' Connector.