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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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