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

Form does not submit with Default Values

Having a strange issue with a form i'm working on at the moment. My datasource is a SharePoint list. Right now, I'm working with just one field ("Line Manager") which is a person field. On my form I have set the datacard's default value to the following:

If(FormCreateNewRequest.Mode = New, Office365Users.Manager(Office365Users.MyProfile().Mail), ThisItem.Line_x0020_Manager)

When I navigate to the form and submit it using the SubmitForm method, I receive the error below. I've set the SharePoint list to have no required fields, but the error persists. However, if I change the value of this field (i.e. Type the name of someone else and select them) the form will submit succesfully.

powerappsformerror.PNG

 

I have tried to work around this bug by instead getting the value of this field and then patching the record manually:

Patch('IT Equipment Requests', Defaults('IT Equipment Requests'),
	{
		Line_x0020_Manager: DataCardLineManagerInput.Selected
        }
)

Unfortunately this won't work as the following error is detected in the Patch function:

 

powerappsformerror2.PNG

 

Soo my question now is, how do i correctly emulate setting a "Person" field using Patch, or is there something I'm doing wrong with setting the Default property of that field?

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Form does not submit with Default Values

Hi @Meneghino, thanks for the tip!

 

I had a closer look at how Powerapps interprets a Person field by creating a collection from my list data. Managed to find the correct OData type there.

 

The following code appears to work to manually patch a person field, allowing us to use the search ability on an Edit Form but without using the SubmitForm method. *note, i changed the column to be named "approver" for other reasons

 

Patch('IT Equipment Requests', Defaults('IT Equipment Requests'),
	{
		Approver : {Claims: DataCardValue1.Selected.Claims, Department: DataCardValue1.Selected.Department, DisplayName: DataCardValue1.Selected.DisplayName, Email: DataCardValue1.Selected.Email, JobTitle: DataCardValue1.Selected.JobTitle, Picture: DataCardValue1.Selected.Picture, '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser"}
	}
)

 

View solution in original post

2 REPLIES 2
Highlighted
Meneghino
Level 10

Re: Form does not submit with Default Values

Hi @Anonymous

In order to patch to a person type field you need to patch a record, not a value.  That record needs to include the correct @odata.type field value.  Basically the approach is the same as in this post:

https://powerusers.microsoft.com/t5/PowerApps-Forum/Solved-patching-to-SharePoint-choice-and-lookup-type-columns/m-p/21561

 

But the record fields will be different, and I think the odata value is also different, but I have not looked at it in a while.

 

Please come back if you have trouble figuring it out.

Anonymous
Not applicable

Re: Form does not submit with Default Values

Hi @Meneghino, thanks for the tip!

 

I had a closer look at how Powerapps interprets a Person field by creating a collection from my list data. Managed to find the correct OData type there.

 

The following code appears to work to manually patch a person field, allowing us to use the search ability on an Edit Form but without using the SubmitForm method. *note, i changed the column to be named "approver" for other reasons

 

Patch('IT Equipment Requests', Defaults('IT Equipment Requests'),
	{
		Approver : {Claims: DataCardValue1.Selected.Claims, Department: DataCardValue1.Selected.Department, DisplayName: DataCardValue1.Selected.DisplayName, Email: DataCardValue1.Selected.Email, JobTitle: DataCardValue1.Selected.JobTitle, Picture: DataCardValue1.Selected.Picture, '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser"}
	}
)

 

View solution in original post

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,827)