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 / Patch function is not ...
Power Apps
Unanswered

Patch function is not working after publishing the application

(1) ShareShare
ReportReport
Posted on by 12

Hi,

 

I've created an app and it's working fine but once I publish it the button for Patch function is not working!! Is there anything that I have to do to make the app working as it should be in the development stage?

 

You can find the code that I'm using for Submission.

 

Thank you all.  

Categories:
I have the same question (0)
  • ANB Profile Picture
    7,223 Super User 2025 Season 2 on at

    Hi @kamel7777 , I dont see any code.

     

    Thanks,

    ANB

  • powerJu Profile Picture
    34 on at

    You should double check your Patch function - If there is any error or required field set on Dataverse, you should include it on the patching.

    I dont know if I got it right. It was working and after publishing it stopped ?

  • kamel7777 Profile Picture
    12 on at
    //Patch all records to Abudawood's Cafe 1 List
    ForAll(
     galCart.AllItems,
     Patch(
     'Abudawood''s Cafe 1',
     Defaults('Abudawood''s Cafe 1'),
     {
     Quantity: Value(TextInput1.Text),
     Drinks: ThisRecord.Item.Title,
     'Office Number': dd3.Selected.Title,
     'Office Zone':dd4.Selected.Title,
     'Order ID': gID.Text,
     'User Name': usrNam.Text,
     'Date And Time ': Text( Now(), "mm/dd/yyyy hh:mm:ss" )
     //'Order Ref': Value(gID.Text)
     }
     )
    );
     
     
    //Patch all records to Orders Report List
    ForAll(
     galCart.AllItems,
     Patch(
     'Orders Report',
     Defaults('Orders Report'),
     {
     Quantity: Value(TextInput1.Text),
     Drinks: ThisRecord.Item.Title,
     'Office Number': dd3.Selected.Title,
     'Office Zone': dd4.Selected.Title,
     'Order ID': gID.Text,
     'User Name': usrNam.Text,
     'Date And Time ': Text( Now(), "mm/dd/yyyy hh:mm:ss" )
     }
     )
    );
     
    //Reset dropdown lists values
    Reset(dd3);
    Reset(dd4);
     
    //clear cart box
    Clear(colProductOrder);
     
    Navigate(
     ConfirmationScreen,
     ScreenTransition.Fade
    );
     
    //ID generator variable
    Set(varCurrentDateTime, Now());
  • kamel7777 Profile Picture
    12 on at

    I'm not using Dataverse at all , Only Sharepoint list.

     

    Answering your question that yes once I publish the application to try it before send it to other employees the patch button not working. 

  • ANB Profile Picture
    7,223 Super User 2025 Season 2 on at

    @kamel7777 Can you confirm what is the Items property of your gallery? Is there any specific code on item property, if yes, please share that too.

     

    Thanks,

    ANB

  • fhamm Profile Picture
    on at

    Is there a particular error message that is popping up when you try to push the button for the Patch function?

  • kamel7777 Profile Picture
    12 on at

    Hi @ANB ,

    there are no codes in the item property, Only to display the list content.

  • kamel7777 Profile Picture
    12 on at

    Hi @fhamm ,

     

    No there is no error message appears, It seems like nothing is happening and it should goes to another screen which contains the order reference after pressing the submit button. 

  • fhamm Profile Picture
    on at

    When you click the patch button, is any data being patched back to your data source? If so, then the error might be in the later half of your code.

     

    If data isn't being patched at all, try commenting out one line of the Patch code at a time until the Patch works to find where the error lies. Maybe there is something wrong with the way one of the fields is written for your data source. If the Patch works with some of the fields commented out, then you'll know that there was something wrong with that line of code.

  • kamel7777 Profile Picture
    12 on at

    I followed each line and indeed one of them was causing this issue which is this line : 

    'Order ID': gID.Text,

     I tried to make a variable for it to be like this : 

    Set(
     orderid,
     Text(
     Upper (
     Concatenate(
     Left(
     User().FullName,
     2
     ),
     "-",
     Text(
     varCurrentDateTime,
     "hhmmss"
     )
     )
     )
     )
    );

     

    Then I replaced the old line with this new formula:

    ForAll(
     galCart.AllItems,
     Patch(
     'Abudawood''s Cafe 1',
     Defaults('Abudawood''s Cafe 1'),
     {
     Quantity: Value(TextInput1.Text),
     Drinks: ThisRecord.Item.Title,
     'Office Number': dd3.Selected.Title,
     'Office Zone': dd4.Selected.Title,
     'User Name': usrNam.Text,
     'Order ID': orderid,
     'Date And Time ': Text(
     Now(),
     "mm/dd/yyyy hh:mm:ss"
     )
     
     }
     )
    );

     

    Now the patch is working, I don't know why it wasn't work earlier but now it's okay.

    Thank you.

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard