web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patching Lookup Fields...
Power Apps
Answered

Patching Lookup Fields...

(0) ShareShare
ReportReport
Posted on by 60
I have a deliverable list that has a lookup field for the status that I have been patching without an issue. Over the weekend I altered the lookup to include other fields that denote if that status is included in certain filters.
 
The fields are listed as required but also read only, but I am getting an error that states that I must enter something in that field when I try and patch.
 
What must one do to push data to a "required but read only" field for a lookup?
 
Here is what has worked for that field so far:
 
Status:
        {
            Value: "In Progress",
            Id: 4
        }
PatchLookup.png
Categories:
I have the same question (0)
  • Sam_Fawzi Profile Picture
    917 Super User 2026 Season 1 on at
    Hi @ ,
     
    can you share the error message you are getting the data sources that you are using and full patch syntax.
  • JasonD Profile Picture
    60 on at
    The error message is stating that the pending field is required. the data source is sharepoint.
     
    The patch syntax is correct as it has been working for months and the only change that has been made was me including more fields on the lookup field.
  • JasonD Profile Picture
    60 on at
    Patch call that worked before adding the extra fields to the lookup:
     
    //Add Project header to table
    Patch(ProjectDeliverables,
        {
            Project:
            {
                Id: Value(First(referencedProject).ID),
                Value: First(referencedProject).ProjectName
            },
             DeliverableType:
            {
                Id: 17,
                Value: "Header"
            },
            DeliverableOrder: LookUp(localDeliverableTypes, Type="Header").Order,
            RowOrder: 0,
            RowType:
            {
                Value: "Header"
            },
            Status:
            {
                Value: "In Progress",
                Id: 4
            },
            DeliverableDataDef:
    "{
        ""Updates"":
          {
            ""Last"": """",
            ""Next"": """ & Text(DateAdd(Today(), 14 + (4-Weekday(Now()))), "m/d/yyyy") &"""
          },
          ""Freight"": " & wizFreightTotal & ",
          ""Bonded"": false
    }"
     
        }
    );
    FieldStatusPendingRequired.png
  • JasonD Profile Picture
    60 on at
    I added the Defaults(Datastore) call to the patch method and nothing changed. I am sure that I can change the lookup field to not be required and that will address the issue, but I do not want to lift that restriction as the status field is required based on the business logic.
  • Verified answer
    JasonD Profile Picture
    60 on at
    I was able to enact a fix for this...
     
    The root of the problem was the Status field was set to required. When I added the other lookup fields (ToDo, Pending and Action) they too came over as required. Problem is these other fields are also read-only. So you have a field that requires you to enter information, but will fail if you enter information as it is read only.
     
    Solution:
    1. Remove the added lookup fields.
    2.  Set the initial lookup with just the one field to not be required.
    3. Go back and add the extra lookup fields
    4. Go back and set the original field to be required
    5. Bring up the list settings to verify that the original lookup is required and the others that were added are still set to not be required.
    I have tested the patch function after putting it back to what it was earlier and it is working.
    StatusFix.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 424

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
11manish Profile Picture

11manish 290

Last 30 days Overall leaderboard