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 / Patch a CDS image colu...
Power Apps
Answered

Patch a CDS image column? Am I wasting my time?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm trying everything I can think of to update a CDS image column. Is this possible NOT using a form? I need to run this in a ForAll. Thank you.

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Every time I try patching like this:

    Patch(myEntity, myRecord,
    {
    imageColName: {Full: 'Image from different record', Value: 'Same image from different record'}
    }
    )


    It lets me type it all in but as soon as I close the last parentheses it completely crashes the web editor and I have to start a new session. 

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This also crashed the web editor as soon as I typed the last parentheses:

     

    Patch(Table(MyEntityRecord.imageCol), First(Table(MyEntityRecord.imageCol)),
    {
    Full: 'ImageFromDifferentRecord'.Full,
    Value: 'ImageFromDifferentRecord
    }
    )

     

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Do you want to update the Image Type column of your CDS Entity using Patch function?

     

    The user @JFN has faced same issue with you, please check my response within the following thread:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Can-t-get-image-to-save-to-custom-entity-in-CDS/m-p/464804

     

    Currently, I also have made a test on my side using Patch function, the Patch function could also update image type field in CDS Entity as well as the Edit form.

     

    I have made a test on my side, please consider take a try with the following workaround:

    5.JPG

     

    6.JPG

    Add a Gallery control in your app, connect it to your CDS Entity, then list the all available records within this Gallery.

    Add a "Add Picture" control in your app, to pick up image for the selected item in your Gallery. Set the OnSelect property of the "Change" button to following:

    Patch(
     TaskLists, 
     BrowseGallery1.Selected, 
     {
     TaskImage: {
     Full: UploadedImage1.Image, 
     Value: UploadedImage1.Image
     }
     }
    )

    Note: The TaskImage is a Image Type field in my CDS Entity (TaskLists). Please refer to the following GIF screenshot:

    Test.gif

     

    In addition, if you want to update the Image type field within a ForAll function, please take a try with the following formula:

    ForAll(
     xxxxx,
     Patch(
     TaskLists, 
     "iterated record you want to update", 
     {
     ImageField: {
     Full: UploadedImage1.Image, 
     Value: UploadedImage1.Image
     }
     }
     )
    )

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for the response.  I actually came up with a work around that is similar to yours. I added an "updated" column to my CDS entity with default to "no". Then added a Form4 on a blank screen that won't be navigated to with just a picture and set it's item property to:

     

     

    First(Filter(entity, commonKey = opGal.Selected.commonKey, updated = 'updated (entity)'.No

     

     

    The opGal gallery is looking at my main data table and filtering to a set of records. 'commonKey' is the column that holds a value common to certain records on the table, NOT in the opGal set. If a record in the opGal set with a commonKey is changed, all of the records with the same commonKey have to also change certain fields, but not all of them. So I have a Form1 to change the opGal.Selected, that's no problem. 

     

    Form4's add image is set to default to opGal.Selected.image. I have a button to SubmitForm(Form1)  I'll paraphrase below:

     

    SubmitForm(Form1);
    If(opGal.Selected.common = Yes,
     SubmitForm(Form4))

     

     

    Then Form4's OnSuccess property:

     

    If(!IsBlank(First(Filter(entity, commonKey = opGal.Selected.commonKey, updated = 'updated (entity)'.No)),
    SubmitForm(Form4);
    Patch(entity, First(Filter(entity, commonKey = opGal.Selected.commonKey, updated = 'updated (entity)'.No),
    {
    updated = 'updated (entity)'.Yes
    shortTextCDS: opGal.Selected.shortTextCDS,
    longTextCDS: opGal.Selected.longTextCDS
    }
    );
    Refresh(entity)

     

     

    So that works, the "ForAll" is essentially handles by telling form the default to the first record of the records with same commonKey and updated = No, sends changes with the SubmitForm then changes the updated to Yes which kicks it of the filtered table and the next in line gets changed until that table is blank. I tried using Form4 to also change the updated column and the other columns that needed to be changed but it wasn't working well...it was finicky for some reason. The patch seemed to work better.

     

    It seems to work fairly well though it is very work-aroundy. There's also a step tied into the Form1's submit button to reset the "updated" column back to "No" if it's to be a globaledit:

     

     

    If(globalEdit,
    
    ClearCollect(globEdit, ShowColumns(Filter(entity, commonKey = opGal.Selected.commonKey), "crd2e_stepkey"));
    
    
    ForAll(RenameColumns(globEdit, "crd2e_stepkey", "patchKey"), 
    
    Patch(entity, LookUp(entity, stepKey = patchKey),
    
    { 
     updated: 'updated (entity)'.No
    } 
    ));

     

    I suppose this could be done at the end of Form4's submit routine but I don't think it really matters. Anyway, this worked. It would be nice however if I could simply patch an new image to a record with an existing image. That would be amazingly simple and it's kind of mind boggling to me that it isn't possible in any straightforward way. 

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Have you solved your problem?

    Is the solution I provided above helpful in your scenario?

     

    I also agree with your solution almost. If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

     

    Best regards,

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard