cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ramole
Super User
Super User

Unable to Patch to SharePoint Lookup field

Hi 

 

 

I am trying to update a record on different list but the updating list field 'Business Name' is text also same time to Patch a new record to another list SharePoint, where one of the columns Company in SharePoint is a Look Up field.

Using the code below, only patches when I hard code the lookup field which is Company.Value 
Not sure what I am missing.

 

 

Company: {
            Id: 961,    // I have to hard code to get correct person name 
            Value: varFormDataChecks.'Business Name'
        }

 

 

This is the Lookup Field i am having trouble to patch 

CaptureLookup.PNG

 

CaptureLookup2.PNG

 

 

 

 

 

 

 

UpdateIf(
    'Check Management',
    ID = varFormDataChecks.ID,
    {amount: varFormDataChecks.amount - Value(txtAmountPay.Text)}
);
UpdateIf(
    'Check Management',
    amount = Value(0),
    {
        amount: Value(0),
        Status: {Value: "Close"}
    }
);
/*Updating another List (Company Feild is a .Value Lookup in the back End)*/
Patch(
    'Loan Management',
    Defaults('Loan Management'),
    {
        Notes: txtCommentPay.Text,
        LoanRequestedDate: datePickerPay.SelectedDate,
        LoanAmount: Value(txtAmountPay.Text),
        Company: {
            Id: 961,    // I have to hard code to get correct person name 
            Value: varFormDataChecks.'Business Name'
        },  // This list company is .Value in back end sharepoint 
        LoanDueDate: Now(),
        'Invoice Number': txtRefNoPay.Text,
        Balance: Value(TextInput4_18.Text),
        CompanyName: varFormDataChecks.'Business Name'
    }
);

 

 

 

Thank you
If this post helps, then Click on the Thumbs Up below. and Accept it as the solution . to help others find helpful.
2 ACCEPTED SOLUTIONS

Accepted Solutions
haris00000001
Advocate I
Advocate I

yes its possible like this "Mycolumn.Text" to other filed "MyCloumn2.Text"

View solution in original post

Hi @haris00000001  

 

Here is the full code incase someone else needed 

 

 

 

 

Patch(
    'Loan Management',
    Defaults('Loan Management'),
    {
        Notes: txtCommentPay.Text,
        LoanRequestedDate: datePickerPay.SelectedDate,
        LoanAmount: Value(txtAmountPay.Text),
        Company: {
            Id:LookUp(Customers,Company = varFormDataChecks.'Business Name').ID,
            Value: Text(varFormDataChecks.'Business Name')
        }, 
        LoanDueDate: Now(),
        'Invoice Number': txtRefNoPay.Text,
        Balance: Value(TextInput4_18.Text),
        CompanyName: varFormDataChecks.'Business Name'
    }
)

 

 

I lookup the main Parent Customers list which is different than the one I was looking 

 

Company: {
            Id:LookUp(Customers,Company = varFormDataChecks.'Business Name').ID,
            Value: Text(varFormDataChecks.'Business Name')
        }, 

 

 

I will mark also this one as is got full code 

 

 

 

 

Thank you
If this post helps, then Click on the Thumbs Up below. and Accept it as the solution . to help others find helpful.

View solution in original post

4 REPLIES 4
haris00000001
Advocate I
Advocate I

you can use " 'My Lookup Column'.Id "

Hi @haris00000001 

Is it possible as the one i would like to copy from is text field to Lookup field on other list ?

Thank you
If this post helps, then Click on the Thumbs Up below. and Accept it as the solution . to help others find helpful.
haris00000001
Advocate I
Advocate I

yes its possible like this "Mycolumn.Text" to other filed "MyCloumn2.Text"

Hi @haris00000001  

 

Here is the full code incase someone else needed 

 

 

 

 

Patch(
    'Loan Management',
    Defaults('Loan Management'),
    {
        Notes: txtCommentPay.Text,
        LoanRequestedDate: datePickerPay.SelectedDate,
        LoanAmount: Value(txtAmountPay.Text),
        Company: {
            Id:LookUp(Customers,Company = varFormDataChecks.'Business Name').ID,
            Value: Text(varFormDataChecks.'Business Name')
        }, 
        LoanDueDate: Now(),
        'Invoice Number': txtRefNoPay.Text,
        Balance: Value(TextInput4_18.Text),
        CompanyName: varFormDataChecks.'Business Name'
    }
)

 

 

I lookup the main Parent Customers list which is different than the one I was looking 

 

Company: {
            Id:LookUp(Customers,Company = varFormDataChecks.'Business Name').ID,
            Value: Text(varFormDataChecks.'Business Name')
        }, 

 

 

I will mark also this one as is got full code 

 

 

 

 

Thank you
If this post helps, then Click on the Thumbs Up below. and Accept it as the solution . to help others find helpful.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,345)