cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dorinda
Post Patron
Post Patron

Patch Lookup field to SharePoint List

I have the following code that is working as expected

 

First(
Filter(
CurrentEmployeeOrg,
Lower(Email) = Lower( First( DataCardValue127.SelectedItems).Email))
).EmployeeNumber

 

However it is not putting the information in the SharePoint list for Employee Id, from this lookup.

 

I know it needs to be something like ThisItem.'Employee ID'

 

However it throws an error when I attempt to use it.

 

Any ideas how to get this to write back to the correct field?  The update and default are set correctly but it is just erasing the information in the field in SharePoint when it patches back to the list.

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@Dorinda 

So again, to reemphasize, this is why splitting the form the way that I show in the video is significant.  It puts all of the Form logic for submitting and validating and error checking back into the form itself, instead of a patch statement.

If you submit form1 and then you're going to have to have logic in the ensuing forms to use the record that was first submitted.  It gets really nasty.

 

The other last ditch effort you can do is to augment your Patch statement like this:

Patch('2021 Evaluations', varCurrent,
    Defaults('2021 Evaluations'),
    Form1.Updates,
    Form1_1.Updates,
    Form1_3.Updates,
    Form1_4.Updates,
    {'Employee ID': Form1.Updates.'Employee ID'}
)

This way you know the last override is the value you want.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

24 REPLIES 24
RandyHayes
Super User III
Super User III

@Dorinda 

Can you describe more about where the formula you posted is located?

I am assuming you are working with a form as you mention the Update and Default properties.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Yes I am working in a form that has several fields that are looking up to another SharePoint list, that is the CurrentEmployeeOrg list, it looks up the email of that person add pulls the corresponding employee id and displays it just fine in the form.  However when the form is saved it is not saving that information to the SharePoint list, this is what I am trying to solve for

 

Dorinda

RandyHayes
Super User III
Super User III

@Dorinda 

What is the underlying column of the datacard that is not saving (text, person, choice)?

What is the update property of that datacard?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

single line of text flat

 

Update:  DataCardValue3.Text

RandyHayes
Super User III
Super User III

@Dorinda 

So is DataCardValue3 the control that contains the information you want?

You posted this formula first:

First(
Filter(
CurrentEmployeeOrg,
Lower(Email) = Lower( First( DataCardValue127.SelectedItems).Email))
).EmployeeNumber

 

Is this the formula in the DataCardValue3 control?

 

Please clarify the following:

1) What kind of control is DataCardValue3?

2) Where is the formula you originally posted used?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Here are screenshots of both

Capture.PNG2021-01-06_16-07-45.png

Dorinda
Post Patron
Post Patron

Sorry hit the reply before i added context.  The delgation warning is nothing to worry about as the list is less then a 1000 items, The employee name patches fine the employee id doesnt.

Dorinda
Post Patron
Post Patron

2021-01-06_16-14-56.png

RandyHayes
Super User III
Super User III

@Dorinda 

Okay...

So, first, just because it's driving me nuts...the formula you have should really be this:

LookUp(CurrentEmployeeOrg,
    Lower(Email) = Lower(DataCardValue127.Selected.Email),
    EmployeeNumber
)

Just one of those things...performance and all that.  First(Filter makes PowerApps first grab ALL of the records it can, and then return the first one.  LookUp will return the first one it finds and then it is done.  Also, Selected will give you the selected item from the ComboBox (DataCardValue127)

 

The next question would be - and this is for validation of where I'm going - When you Submit the Form, and you then go and look at the SharePoint list, the Employee ID is empty?  Or is it that when you enter your form again to view the existing record, that no value is there?  This is a significant question.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (39,750)