Check if Owner of a DataVerse record is User or Team in Power Apps canvas apps

Hello everyone and welcome to my blog. In today’s blog we will discuss on how to check if the owner of a dataverse record is a User or Team in Canvas apps.

If you have worked with DataVerse, you know that you can set thee Owner of record either to a team or a user.

Below is a canvas app where I am displaying a Contact record on Canvas app form.

The requirement here is to display the name of the owner. But the owner can be a user of team. How do I go ahead and show the display name of the owner?

Below is the code to do that.

If(
    IsType(
        Gallery1.Selected.Owner,
        Users
    ),
    AsType(
        Gallery1.Selected.Owner,
        Users
    ).'Full Name',
    AsType(
        Gallery1.Selected.Owner,
        Teams
    ).'Team Name'
)

The formula is pretty simple. The two most important functions here IsType and AsType. IsType function can be used to determine the type of the record, whether a user or team. And once I determine the type I typecast it to the appropriate type and get the name of the Owner.

Hope you liked the post. If this post has helped you, you can buy me a coffee. Links on right side panel.

You will also like the below posts.

Debajit Dutta
Business Solutions MVP