cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Setting default on Form, can not choose complex field default value

I have a connection to SharePoint list and the list has complex field (People/Group). 

I have an edit form, and I am trying to make it show different things depending if it is in New mode or Edit mode.

Here is what I have so far in the cards default function:

If(FormMode=Edit,ThisItem.Traveler,
{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
             Claims:Concatenate("i:0#.f|membership|",UserProfileCollection.Mail),
             Department:UserProfileCollection.Department,
             DisplayName:UserProfileCollection.DisplayName,
             Email:UserProfileCollection.Mail,
             JobTitle:UserProfileCollection.JobTitle,
             Picture:""
})

It does work but it does not allow to select to show any other value in the field than odata.type or Picture. I would like to change Value1 to DisplayName.

Is there a workaround so that I can still use this default function but it would display the DisplayName instead of the list type?

It is strange because I have almost identical code for another default value but it allows me to select any of the fields (Department, DisplayName, Email, JobTitle) only this one for some reason does not allow to select fields that are set by using UserProfileCollection

 

Here how it looks in PowerApps:

1.png

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Setting default on Form, can not choose complex field default value

After some experimentation I finally found my stupid mistake.

 

For collections you have to specify which record to take. So just a simple fix of changing UserProfileCollenction to First(UserProfileCollection) fixed the issue.

Here is the correct code:

If(FormMode=Edit,ThisItem.Traveler,
{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
             Claims:Concatenate("i:0#.f|membership|",First(UserProfileCollection).Mail),
             Department:First(UserProfileCollection).Department,
             DisplayName:First(UserProfileCollection).DisplayName,
             Email:First(UserProfileCollection).Mail,
             JobTitle:First(UserProfileCollection).JobTitle,
             Picture:""
})

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Re: Setting default on Form, can not choose complex field default value

After some experimentation I finally found my stupid mistake.

 

For collections you have to specify which record to take. So just a simple fix of changing UserProfileCollenction to First(UserProfileCollection) fixed the issue.

Here is the correct code:

If(FormMode=Edit,ThisItem.Traveler,
{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
             Claims:Concatenate("i:0#.f|membership|",First(UserProfileCollection).Mail),
             Department:First(UserProfileCollection).Department,
             DisplayName:First(UserProfileCollection).DisplayName,
             Email:First(UserProfileCollection).Mail,
             JobTitle:First(UserProfileCollection).JobTitle,
             Picture:""
})

View solution in original post

Community Support Team
Community Support Team

Re: Setting default on Form, can not choose complex field default value

Hi MartynasJurkus,

 

I am so glad to hear that the function now is working for you.


Thanks for updating. Anytime you have issue when working with PowerApps, please feel free post your issues here, we’re always ready to help.

 

 

Best regards,
Mabel Mao

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

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

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