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 Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (4,078)