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 Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (1,814)