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 / Urgent Help ! Patch No...
Power Apps
Answered

Urgent Help ! Patch Not working Properly!!

(0) ShareShare
ReportReport
Posted on by 20

Dear Experts, I would be grateful for your help.

 

I am facing an issue with the Patch function, I have a use case in which I have a connected a power app in a power bi report

Where the PowerAPP is being used to take the comments, I am using the patch function to fetch the data from power bi to power apps and then I have added a text input column to get the comments.

 

It is working fine, but even if there is a second comment on a specific material no, it is creating another row, what I want is, that once a comment is submitted, and if there is any previous comment it should update it with the recent comment.

 

If there is no comment, then it should save the comment as it is, in the SharePoint list.

 

I have been trying to do it since many days but i have unable to do it.

 

PS: i am using a gallery to show the data and to take the comments.

This is the code i am using to patch the data from PowerBI to Powerapps and then to submit the comments in the Sharepoint list.

Patch(SharepointlistName,{Title:"1", Commentcolumn:TextInput2.Text,MaterialColumn:ThisItem.MATERIALColumn, PLANNER_CD:ThisItem.PLANNER,


MAT_DESC:ThisItem.DESC_EN,BUS_LINE:ThisItem.BUS_LINE});Navigate(Screen2,ScreenTransition.None)

 

I would be thankful for your help!

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,066 Most Valuable Professional on at

    Hi @cryptosun ,

    You need to tell Power Apps which record to Patch to - assuming you have the ID of that record

    Patch(
     SharepointlistName,
     {ID:YourIDNumber},
     {
     Title: "1", 
     Commentcolumn: TextInput2.Text,
     MaterialColumn: ThisItem.MATERIALColumn, 
     PLANNER_CD: ThisItem.PLANNER,
     MAT_DESC: ThisItem.DESC_EN,
     BUS_LINE: ThisItem.BUS_LINE
     }
    );
    Navigate(
     Screen2,
     ScreenTransition.None
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • cryptosun Profile Picture
    20 on at

    I tried using the {ID: thisID.ID} but it gives an error.

     

    I would like to update the comment to the recent one, i am unsure how will the id recognize whether its a latest comment or not, looking forward to your kind response.

     

     

  • WarrenBelz Profile Picture
    155,066 Most Valuable Professional on at

    @cryptosun ,

    How are you selecting the record - if from a gallery it will be (change to your gallery name)

    YourGalleryName.Selected.ID

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

     

  • cryptosun Profile Picture
    20 on at

    The record is being selected from a PowerBI report.

     

    So basically, once a user selects an entry in the PowerBI report and clicks on the comment button. it opens a popup window of PowerAPP, in which few columns are automatically fetched from the selected specific entry, eg; material name, description etc and the user just have to write a comment, which is saved in the sharepoint list. it works fine. but if there is another comment on the same entry it creates another row with the latest comment.

     

    However, my usecase is, if there is another comment on the same specific entry, it should be updated with the latest comment in the Sharepoint list.  

  • cryptosun Profile Picture
    20 on at

    The record is being selected from a PowerBI report.

     

    So basically, once a user selects an entry in the PowerBI report and clicks on the comment button. it opens a popup window of PowerAPP, in which few columns are automatically fetched from the selected specific entry, eg; material name, description etc and the user just have to write a comment, which is saved in the sharepoint list. it works fine. but if there is another comment on the same entry it creates another row with the latest comment.

     

    However, my usecase is, if there is another comment on the same specific entry, it should be updated with the latest comment in the Sharepoint list.  

  • WarrenBelz Profile Picture
    155,066 Most Valuable Professional on at

    Hi @cryptosun ,

    Sorry I have no idea how to get the ID as I do not use that interface., however you need the ID of the record to patch to it.

  • cryptosun Profile Picture
    20 on at

    Thankyou for the response. So lets say after i manage to get the ID work, will it show the recent comment? Becaudr i don't understand how it will update the old comment with new comment if wd use id?

  • WarrenBelz Profile Picture
    155,066 Most Valuable Professional on at

    @cryptosun ,

    The ID simply identifies the record to be Patched. Whatever is in the field currently will be over-written by the new content you are Patching.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @cryptosun ,

     

    You just need to check whether current item is already in the list and decide to update the exist item or create a new line. I assume the MaterialColumn is a unique value column for this SP list, please try below formula:

    If(IsBlank(LookUp(SPlist,MaterialColumn = ThisItem.MATERIALColumn)),
     Patch(
     SPlist,
     Defaults(SPlist),
     {
     Title: "1", 
     Commentcolumn: TextInput2.Text,
     MaterialColumn: ThisItem.MATERIALColumn, 
     PLANNER_CD: ThisItem.PLANNER,
     MAT_DESC: ThisItem.DESC_EN,
     BUS_LINE: ThisItem.BUS_LINE
     }
     ),
     Patch(
     SPlist,
     LookUp(SPlist,MaterialColumn = ThisItem.MATERIALColumn)
     {
     Title: "1", 
     Commentcolumn: TextInput2.Text,
     }
     )
    );
    Navigate(
     Screen2,
     ScreenTransition.None
    )

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • cryptosun Profile Picture
    20 on at

    Thankyou for your response.

     

    Material column is unique yes, but it would be autofetched every time when i click on an entry in the PowerBI Report and user just have to enter the comment, which i want to update everytime, if there is an existing comment.

     

    The above code works fine, except an error at this part

    Patch(
     SPlist,
     LookUp(SPlist,MaterialColumn = ThisItem.MATERIALColumn)
     { ----- AT THIS PART IT GIVES AN ERROR SAYING(Unexpected characters, the formula contains 'ParenClose' where 'CurlyOpen' is expected along with another error (Unexpected characters,Characters are used in the formula in an unexpected way.
     Title: "1", 
     Commentcolumn: TextInput2.Text,
     }
     )
    );
    Navigate(
     Screen2,
     ScreenTransition.None
    )

    I would be grateful if you could help me to resolve the issue.

     

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 522

#2
WarrenBelz Profile Picture

WarrenBelz 437 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 405

Last 30 days Overall leaderboard