web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : U68ihftHcQpXTcXc0Q+rAz
Power Apps - Building Power Apps
Answered

Network Error when using patch function: The specified record was not found.

Like (0) ShareShare
ReportReport
Posted on 14 Feb 2024 12:00:10 by 20

Hi I'm trying to insert variables into a SQL table via a patch function. The button works fine until I try to capture the User().Email and insert it too.

Patch(
 'assurance.comments',
 Defaults('assurance.comments'), // If varIdea is blank, use default values; otherwise, use varIdea
 {
 assurance_contractid: TextInput6.Text, // Use the selected value from ComboBox1_2
 assurance_comments: 'text metrics input_5'.Text, // Use the value from text input named 'text metrics input_2'
 insert_DateTime: Now(), // Use the current date and time
 assurance_userid: User().Email
 }
);
The SQL table has all the required columns (see photo) and when I remove the assurance_userid: User().Email part it works again it works.SQL table.PNG
 
Can anyone offer any advice?
 
Thanks,
  • Verified answer
    NiiruK Profile Picture
    20 on 15 Feb 2024 at 11:08:39
    Re: Network Error when using patch function: The specified record was not found.

    All,

     

    Thank you again for your efforts on this.

     

    I've managed to find a solution to this.

     

    When a change was made i.e. adding an additional column to the database table the data connection needed to be dropped and re-added again and the patch is working again.

     

    Hope this helps someone else in a similar situation.

  • NiiruK Profile Picture
    20 on 14 Feb 2024 at 16:50:15
    Re: Network Error when using patch function: The specified record was not found.

    I tried you code and thought the lack of errors was promising but I'm still getting the error: record was not found patch error. I'm starting to think this might be a SQL error as the PowerApp code makes sense but just isn't getting executed. I've posted some snippits in the response above from SQL showing I have the column in SQL but there's a potential issue with the column itself. Going to run this by one of the database SME's to see if it's something I've done wrong on the SQL side. Thanks for your answer Powerapp code try.PNG

  • NiiruK Profile Picture
    20 on 14 Feb 2024 at 16:42:38
    Re: Network Error when using patch function: The specified record was not found.

    Forgive me I've altered your code a bit. I've tried to change the column name in SQL to [assurance_user_id] instead of [assurance_userid] to see if that would have an affect but the same issue occurs. I have changed your code and have set the onvisible to: LoggedInUserName instead of varUserMailSQL onvisible.PNG

    When i try this code out i still get the Network error when using Patch function: the specified record was not found.

    POWERAPP record not found.PNG

    Even though there is a record found in the database e.g. 1MC09 at the bottomSQL record.PNG

    and the column is varchar:SQL varchar 2.PNG

  • Ethan_009 Profile Picture
    4,838 Moderator on 14 Feb 2024 at 13:15:49
    Re: Network Error when using patch function: The specified record was not found.

    Hi @NiiruK ,

     

    What is the datatype of "assurance_userid"? 

    If it is string then it will be inserted.

    If you still face issue try putting value as "Text(User().Email)"

     

    But if you have different datatype then it won't submit.

    To know more about error, you can try the following code:

     

    IfError(
     Patch(
     'assurance.comments',
     Defaults('assurance.comments'), // If varIdea is blank, use default values; otherwise, use varIdea
     {
     assurance_contractid: TextInput6.Text, // Use the selected value from ComboBox1_2
     assurance_comments: 'text metrics input_5'.Text, // Use the value from text input named 'text metrics input_2'
     insert_DateTime: Now(), // Use the current date and time
     assurance_userid: User().Email
     }
     ),
     Notify("Error : " &FirstError.Message, NotificationType.Error, 2000),
     Notify("Success", NotificationType.Success, 1000)
    );

     

    Hope this helps

  • vaubeee Profile Picture
    533 on 14 Feb 2024 at 12:29:06
    Re: Network Error when using patch function: The specified record was not found.

    Hi @NiiruK ! I assume that you've already made sure that the database column accepts the format you are submitting. The issue could be that the 'get the user's email'-operation is performed parallel inline the patch-operation. Try to set a variable OnStart of the app or OnVisible of the screen that already holds that value:

     

    Set(varUserMail; User().Email)

     

    Patch(
     'assurance.comments',
     Defaults('assurance.comments'), // If varIdea is blank, use default values; otherwise, use varIdea
     {
     assurance_contractid: TextInput6.Text, // Use the selected value from ComboBox1_2
     assurance_comments: 'text metrics input_5'.Text, // Use the value from text input named 'text metrics input_2'
     insert_DateTime: Now(), // Use the current date and time
     assurance_userid: varUserMail
     }
    );

     

    ------------------------------------------------------------------------------------------------------------------------------
    If I have answered your question / helped to solve your problem, please accept as solution and give me a Thumbs up. Thanks! - Remember: you can accept more than one post as a solution.

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete