cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

How can we specify types of an object/property?

Suppose we are creating a collection (array of objects). I am populating a sample row to "Teach" PowerApps which types are in this colleciton. This allows DataTables, for example to connect to that colleciton. You get the idea.

 

Sample:

Type of an object.png

 

The queston is this: How do I specify types of a property/object explicitly? For example, I want to say that Stakeholder is a field of type User with such and such properties. For example, I want this type to be compatible with the user picker control (combobox).

 

 

This is how a proper user type looks like. Note how the Picture looks, for example?

 

First User.png 

 

This is a desparate attempt to teach PowerApps that StakeHolder property is a User type:

Complex Object.png

 

As you can see I have to idea how to specify types in PowerApps. 

 

Why we need the ability to specify types:

1) to avoid the annoying error saying that the types are incompatible

2) as a workaround for the new bug introduced in the last two days with DataTables

 

Please, let me know how you do it and if it's even possible. Please, don't suggest specifying Blank() as a workaround. This is not a solution.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How can we specify types of an object/property?

Hi @DenisMolodtsov,

 

Do you mean the Person or group type in SharePoint list?

There is a blog talking about how to set default value of the complex field in SharePoint, see:

Defining default valus for complex SharePoint types in forms

 

Within the collection, for single value of Person field, the record type should be:

 

User:
{ 
  DisplayName:User().FullName,
  Claims:"i:0#.f|membership|" & Lower(User().Email), 
  Department:"",  
  Email:User().Email, 
  JobTitle:"", 
  Picture:""
}

For Multiple select enabled field, the structure should be:

 

 

User:
Table(
{ 
  DisplayName:User().FullName,
  Claims:"i:0#.f|membership|" & Lower(User().Email), 
  Department:"",  
  Email:User().Email, 
  JobTitle:"", 
  Picture:""
},
{ 
  DisplayName:User2.FullName,
  Claims:"i:0#.f|membership|" & Lower(User2.Email), 
  Department:"",  
  Email:User2.Email, 
  JobTitle:"", 
  Picture:""
}
)

Let me know if this works for you.

 

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: How can we specify types of an object/property?

Hi @DenisMolodtsov,

 

Do you mean the Person or group type in SharePoint list?

There is a blog talking about how to set default value of the complex field in SharePoint, see:

Defining default valus for complex SharePoint types in forms

 

Within the collection, for single value of Person field, the record type should be:

 

User:
{ 
  DisplayName:User().FullName,
  Claims:"i:0#.f|membership|" & Lower(User().Email), 
  Department:"",  
  Email:User().Email, 
  JobTitle:"", 
  Picture:""
}

For Multiple select enabled field, the structure should be:

 

 

User:
Table(
{ 
  DisplayName:User().FullName,
  Claims:"i:0#.f|membership|" & Lower(User().Email), 
  Department:"",  
  Email:User().Email, 
  JobTitle:"", 
  Picture:""
},
{ 
  DisplayName:User2.FullName,
  Claims:"i:0#.f|membership|" & Lower(User2.Email), 
  Department:"",  
  Email:User2.Email, 
  JobTitle:"", 
  Picture:""
}
)

Let me know if this works for you.

 

 

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (4,113)