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 / Experiencing issue wit...
Power Apps
Unanswered

Experiencing issue with the Patch Function in PowerApps

(0) ShareShare
ReportReport
Posted on by 15

Good day

 

I need assistance with the patch funtion. I am getting a a runtime error saying that there is a network error when using the Patch function: The requested operation is invalid. and when I double click on Patch it says that the formula has side effects that cannot be evaluated. 

 

This is the formula: 

 

 

Collect(
Coltripdetails,
{
    SiteResponsible: dd_SiteResponsible.SelectedText,
    TripType: dd_TripType.SelectedText,
    DepartureFrom: dd_DepartureFrom.SelectedText,
    ArrivalAt: dd_ArrivalAt.SelectedText
}
);

Patch(
'Driver''s Sheet - Ayabonga Ntlahla_1',
Defaults('Driver''s Sheet - Ayabonga Ntlahla_1'),
{
   'Driver''s Name': txt_DriverName.Text,
   'Fleet Number': txt_FleetNumber.Text,
   Date: DatePicker.SelectedDate,
   'Site Responsible for Cost': LookUp(Coltripdetails,true).SiteResponsible.Value,
   'Trip Type': LookUp(Coltripdetails,true).TripType.Value,
   'Departure From': LookUp(Coltripdetails,true).DepartureFrom.Value,
   'KM before Departure': txt_KmDeparture.Text,
   'Departure Time':txt_TimePicker.Text,
   'Items transported': AllItemsTransportedString,
   'Arrival At':LookUp(Coltripdetails,true).ArrivalAt.Value,
   'KM on Arrival':txt_KmArrival.Text,
   'Arrival Time':txt_ArrivalTime,
  Comments:txt_Comments.Text,
  'Senders Signature': JSON(
  Signature_Sender.Image,
  JSONFormat.IncludeBinaryData
),
  'Receivers Signature': JSON(
  Signature_Receiver.Image,
  JSONFormat.IncludeBinaryData
)

}
)

 

Coltripdetails = A collection I am using to get drop down values as the dropdowns cascading and coming from different data sources.

 

Can you please help me figure out what the problem is with this formula. I am really struggling.

 

Thank you

 

Categories:
  • WarrenBelz Profile Picture
    156,566 Most Valuable Professional on at

    Hi @Xoli ,

    Firstly I have parsed it below for easy reference

    Collect(
     Coltripdetails,
     {
     SiteResponsible: dd_SiteResponsible.Selected,
     TripType: dd_TripType.Selected,
     DepartureFrom: dd_DepartureFrom.Selected,
     ArrivalAt: dd_ArrivalAt.Selected
     }
    );
    
    Patch(
     'Driver''s Sheet - Ayabonga Ntlahla_1',
     Defaults('Driver''s Sheet - Ayabonga Ntlahla_1'),
     {
     'Driver''s Name': txt_DriverName.Text,
     'Fleet Number': txt_FleetNumber.Text,
     Date: DatePicker.SelectedDate,
     'Site Responsible for Cost': 
     LookUp(
     Coltripdetails,
     true
     ).SiteResponsible.Value,
     'Trip Type': 
     LookUp(
     Coltripdetails,
     true
     ).TripType.Value,
     'Departure From': 
     LookUp(
     Coltripdetails,
     true
     ).DepartureFrom.Value,
     'KM before Departure': txt_KmDeparture.Text,
     'Departure Time':txt_TimePicker.Text,
     'Items transported': AllItemsTransportedString,
     'Arrival At':
     LookUp(
     Coltripdetails,
     true
     ).ArrivalAt.Value,
     'KM on Arrival':txt_KmArrival.Text,
     'Arrival Time':txt_ArrivalTime,
     Comments:txt_Comments.Text,
     'Senders Signature': 
     JSON(
     Signature_Sender.Image,
     JSONFormat.IncludeBinaryData
     ),
     'Receivers Signature': 
     JSON(
     Signature_Receiver.Image,
     JSONFormat.IncludeBinaryData
     )
     }
    )

    It is not immediately obvious what exactly you are doing here, but a couple of initial questions

    • Are you simply patching the last item in the collection (collected in the first bit of code) or are you patching the entire collection.
    • What is your data source and what type of fields are the two "signature" fields.
    • What exactly are you trying to do with the LookUp code items in the Patch ?
  • Xoli Profile Picture
    15 on at

    Hello @WarrenBelz 

     

    Thank you for responding. 

     

    To answer your questions.

     

    1. I am patching the entire collection.

    2. The data source is a sharepoint list and the signature fields are Multiple lines of Text columns

    3. I am collecting dropdown values in the collection and I am looking up the text values so that I can write them in corresponding sharepoint list columns as single lines of Text.

  • WarrenBelz Profile Picture
    156,566 Most Valuable Professional on at

    Hi @Xoli ,

    I have to assume that this bit is being run separately to collect the individual items (note the changes here)

    Collect(
     Coltripdetails,
     {
     SiteResponsible: dd_SiteResponsible.Selected.Value,
     TripType: dd_TripType.Selected.Value,
     DepartureFrom: dd_DepartureFrom.Selected.Value,
     ArrivalAt: dd_ArrivalAt.Selected.Value
     }
    );

    and then this is done at the end to patch the entire collection as new records in your list

    With(
     {
     wSender:
     JSON(
     Signature_Sender.Image,
     JSONFormat.IncludeBinaryData
     ),
     wReceiver:
     JSON(
     Signature_Receiver.Image,
     JSONFormat.IncludeBinaryData
     )
     },
     Patch(
     'Driver''s Sheet - Ayabonga Ntlahla_1',
     ForAll(
     Coltripdetails As aPatch,
     {
     'Driver''s Name': txt_DriverName.Text,
     'Fleet Number': txt_FleetNumber.Text,
     Date: DatePicker.SelectedDate,
     'Site Responsible for Cost': aPatch.SiteResponsible,
     'Trip Type': aPatch.TripType,
     'Departure From': aPatch.DepartureFrom,
     'KM before Departure': txt_KmDeparture.Text,
     'Departure Time': txt_TimePicker.Text,
     'Items transported': AllItemsTransportedString,
     'Arrival At': aPatch.ArrivalAt,
     'KM on Arrival': txt_KmArrival.Text,
     'Arrival Time': txt_ArrivalTime,
     Comments: txt_Comments.Text,
     'Senders Signature': wSender,
     'Receivers Signature': wReceiver
     }
     )
     )
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Xoli Profile Picture
    15 on at

    Xoli_0-1677496675736.png

     

    @WarrenBelz  this the error I am getting

     

  • WarrenBelz Profile Picture
    156,566 Most Valuable Professional on at

    @Xoli ,

    Missing a comma - see if you can spot it - the idea of my post was to guide you in the required structure, not necessarily relying on it being perfect syntax (it was free-typed). If you have any other errors, please look at what they are and the likely cause before coming back.

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard