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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patching with photos
Power Apps
Answered

Patching with photos

(0) ShareShare
ReportReport
Posted on by 111
I have a simple inventory List on SharePoint with the basic columns.  
Item, Location, Quantity, and a Photo
 
If I select the item from my gallery to view, that item is set to varSelectedItem.
 
If I click the Edit button I set varEditItem and am able to edit fields.  Clicking Save will patch values back to the List.
 
This is my Save code OnSelect:
 
Patch(
    'Supply Inventory',
    varSelectedItem,
    {
        Item: ItemEditInput.Text,
        Location: LocEditInput.Text,
        Quantity: Value(QtyEditInput.Text),
        Photo: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
             PhotoEditInput.Media
        }
    }
);
Set(varEditMode, false);
Set(varSelectedItem, Blank())
 
Here is my error:


 
I've been using AI to assist in fixing the photo error, but with no avail.  I can't find a specific example of this via youtube or articles, so I'm wondering if any of you know.
Categories:
I have the same question (0)
  • stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    Try this one for the Photo.
     
            Photo: {
                Value: PhotoEditInput.Media,
                Full: "Full",
                Large: "Large",
                Medium: "Medium",
                Small: "Small"
            }
    Your list Location, is the location type column or Just a normal column ?
  • ShanePhillips Profile Picture
    111 on at
    Hi stampcoin, thank you for responding!  The Location field is a basic text column that houses which shelf the item sits on.
     
    That code snippet does indeed clear errors and allows edit updates.   However, if I don't change my photo with the edit, I lose my photo in the List upon submission, even though it's still visible in the edit form.  
     
    I've confirmed this twice.  However, if I add a new photo to the item after it's been removed it writes that photo to the list and updates the item.
     
    My next question is, why am I losing the original photo if I don't replace the existing one?  Thanks in advance.  :)
  • Verified answer
    stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
     
    I see, since it code doesn't check if the image is empty or not. it will use null to overwrite the original one..
     
    try this instead ( you may change accordingly)
    Patch(
        'Supply Inventory',
        varSelectedItem,
        {
            Item: ItemEditInput.Text,
            Location: LocEditInput.Text,
            Quantity: Value(QtyEditInput.Text)
        },
        If(
            !IsBlank(AddMediaButton2.Media),
            {
                Photo: {
                    Value: AddMediaButton2.Media,
                    Full: "Full",
                    Large: "Large",
                    Medium: "Medium",
                    Small: "Small"
                }
            }
        )
    )
    
     
  • ShanePhillips Profile Picture
    111 on at
    You got it.  :)
     
    Thank you, my friend.  I was scratching my head a little too long on this.  I appreciate it.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard