Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Suggested answer

Patch

(1) ShareShare
ReportReport
Posted on by 51
Hi all
 
I am trying to update a sharepoint list
 
However the list is not updating after i patch - Where do i look to troubleshoot?   no errors are being given
 
Patch(
    'Truck Driver Time Card',
    LookUp(
        'Truck Driver Time Card',
        ID = frm_Fleet.LastSubmit.ID
    ),
    {
        'Driver Name': {
            Id: varDriver.ID,
            Value: varDriver.'Full Name'
        },
        'Vehicle Type': {
            Id: varVehicleType.ID,
            Value: varVehicleType.'Vehicle Type'
        },
        Vehicle: {
            Id: varVehicle.ID,
            Value: varVehicle.'Vehicle Details'
        }
    }
);
Notify(
    "Form Submitted Successfully!",
    NotificationType.Success
);
ResetForm(frm_Fleet);
Navigate(scr_Fleet_Main);
Set(varDriver, Blank());
Set(varVehicleType, Blank());
Set(varVehicle, Blank()
);
  • WarrenBelz Profile Picture
    148,328 Most Valuable Professional on at
    Patch
    Just following up to see if you received the answer you needed, or if you require further assistance.

    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • WarrenBelz Profile Picture
    148,328 Most Valuable Professional on at
    Patch
    OK - I see the issue, but this is getting even more complicated because you are using Lookup fields (please heed the advice I gave which was even more accentuated by FLMike - throw them away and use Text fields).
    Your problem is that not only have you used Lookup fields, but then changed the Items of the drop-downs from the default Choices(ListName.FieldName), which would have given you your Id field. You have also created your List from Excel, which gives you the underlying field name syntax of field_x and will cause you more confusion in the future (but this is unrelated to your current problem).
    If you want your Id values back you would need to do something like this
    Set(
       varVehicleType, 
       {
          Value: DataCardValue45.Selected.field_1,
          Id: 
          LookUp(
             YourLookupUpListName,
             YourLookedUpFieldName = DataCardValue45.Selected.field_1,
          ).ID
       }
    )
    but honestly you are far better (it is good to learn good habits from the start) changing them to Text columns and simply using
    Set(
       varVehicleType, 
       DataCardValue45.Selected.field_1
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee
  • bB-27090143-0 Profile Picture
    51 on at
    Patch
    Apologies, Ive tried mapping the fields but that didnt work either...sorry I am a noob at this
     
    im still getting the ID error not found - thats ok im sorry to waste time
     
    Patch(
        'Truck Driver Time Card',
        LookUp(
            'Truck Driver Time Card',
            ID = frm_Fleet.LastSubmit.ID
        ),
        {
            'Driver Name': {
                Id: varDriver.ID,
                Value: varDriver.field_3
            },
            'Vehicle Type':
            {
                Id: varVehicleType.ID,
                Value: varVehicleType.field_1
            },
            'Vehicle':
            {
                Id: varVehicle.ID,
                Value: varVehicle.field_6
            }
        }
    );
    Notify(
        "Form submitted successfully!",
        NotificationType.Success
    );
    ResetForm(frm_Fleet);
     
    Navigate(scr_Fleet_Main);
    Set(varDriver, Blank());
    Set(varVehicleType, Blank());
    Set(varVehicle, Blank());
  • WarrenBelz Profile Picture
    148,328 Most Valuable Professional on at
    Patch
    Have you had a look in the Variables to see what they contain ?
  • bB-27090143-0 Profile Picture
    51 on at
    Patch
    HI there
     
    Setting Variables in "on success" of submit button
     
    Set(varDriver,DataCardValue14.Selected);
    Set(varVehicleType, DataCardValue45.Selected);
    Set(varVehicle,DataCardValue44.Selected);
    SubmitForm(frm_Fleet);
    ResetForm(frm_Fleet)
  • WarrenBelz Profile Picture
    148,328 Most Valuable Professional on at
    Patch
    Can you please answer the specific question I asked - how and when are you setting these Variables - the problem I believe is exactly what I assumed - the ID in the Variables needs to be the ID of the record being looked up in the other list and now you are confirming it is blank.
  • bB-27090143-0 Profile Picture
    51 on at
    Patch
    Ok the patch error I am getting is the Id is blank cannot proceed with blank but I have a column id populating each time numerically
     
    Should I recreate this list as it might be buggy or any other solutuons?
     
    Thanks again for help
  • Suggested answer
    Michael E. Gernaey Profile Picture
    43,787 Super User 2025 Season 1 on at
    Patch
    Hi
     
    So you have 2 possible things
     
    1) That your LookUp is returning NO row and therefor it updates nothing
     
    2) that your variables are bad and have no data, BUT if that's the case, I would expect that in the SharePoint List, the values would be blank.
     
    3) Lookup columns are garbage, never use them, like ever, no matter who tells you they rock they do NOT. Simply map the ID of the Row in the other table into this table, and then if you have to, do a lookup to pull its value. In your code, you could simply do a lookup to the other table, even in what you have to set the LookUp value, versus trying to do it like a record. Again.... they... are ... horrible... never... use them...

    So I believe its #1 not #2.
     
    So how do you validate this first.
     
    Change your code to do this
    What this will do is first pull back the record IF there is one that you want to patch.
    If its there then it will patch, and it will TELL you that it was in the Patch section of the IsBlank check
    If its Not there, meaning your LookUp didnt find a record, then it will tell you that.
     
    then we can figure out why your fmr_Fleet.LastSubmit.ID is bad.
    With(
        {TimeCardRecord: LookUp('Truck Driver Time Card', ID = frm_Fleet.LastSubmit.ID)  },
    
        If(!IsBlank(TimeCardRecord),
    	Patch('Truck Driver Time Card',LookUp('Truck Driver Time Card', ID = frm_Fleet.LastSubmit.ID),
           		{
            	'Driver Name': {
              	  	Id: varDriver.ID,
              	  	Value: varDriver.'Full Name'
              		},
              	'Vehicle Type': {
                		Id: varVehicleType.ID,
                		Value: varVehicleType.'Vehicle Type'
               		},
               	Vehicle: {
                   		Id: varVehicle.ID,
                   		Value: varVehicle.'Vehicle Details'
                		}
             	}
             );
        
    	  Notify("Form Submitted Successfully!",NotificationType.Success);
    	  ResetForm(frm_Fleet);
    	  Navigate(scr_Fleet_Main);
    	  Set(varDriver, Blank());
    	  Set(varVehicleType, Blank());
    	  Set(varVehicle, Blank());
        ,
           Notify("ID was Blank so record returned from LookUp")
        )    
    );
    
    
    
     
     
  • bB-27090143-0 Profile Picture
    51 on at
    Patch
    Thank you
     
    can I ask what you suggest - I’m new to power apps
     
    form is frm_fleet
     
    sharepoint list trying to update with form is Truck driver time card SharePoint list
     
    field in power apps:
     
    driver name field coming from employee lost
    Vehicle type  vehicle list
    vehicle coming from vehicle list this is to allow filtering vehicle by drop down in vehicle list
    all other fields coming from truck driver time card SharePoint list
     
     
    Thanks for any help
     
  • WarrenBelz Profile Picture
    148,328 Most Valuable Professional on at
    Patch
    I suspect the fundamental issue will be the content of varDriver, varVehicle and varVehicleType. You are (I assume) patching to Lookup columns in SharePoint (they honestly are a waste of time and cause nothing but unnecessary complexity - I never use them), so the essential element you require is that the ID column of the Variable contains the ID of the relevant value being looked up in the other list.
    So the question is how and when are you setting these Variables ?

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1