Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

Network error when using patch function field "Id" is required - but Id is an autogenerated number

Posted on 5 Nov 2024 15:11:04 by
Hello members of the community,

I am currently experiencing an issue that seems to be occuring randomly. I would guess about 30-40% of the time a new request is created via my application. So I have an application where users can fill out a form and upload attachments in order to get an approval. The documents are uploaded onto a sharepoint list and used with a seperate flow afterwards to mail them to other users. The relevant part and also where I am experiencing this issue is in the PowerApp. First of all its a Dataverse for teams environment and theres a dataverse table that saves a "Requestnumber" for each form that is submitted.
 
Quick explanation:
 
1. After clicking on the arrow, the form gets submitted as dataverse row entry and has a "Requestnumber"
2. The documents are uploaded to a sharepoint list and given in the column the corresponding "Requestnumber" and also an autogenerated number from the default column "ID" (there is no other column that matches "Id")
 
 
So since the error message "Network error when using patch function field "Id" is required" appears occasionally and I can not fully understand under which circumstances I thought maybe the time between the system assigning the auto generated number "ID" and me using it in my power automate flow was the issue. So I inserted a timer that creates a dummy record which I can then update with the actual data to bypass any time related issue. Spoiler: It still doesnt work smoothly and occasionally drops the error message and does not go forward with the power automate flow and also does appear under "placeholder Title" in the screenshot.
 
Heres my code for the "OnSelect" Property of my check mark icon when trying to submit a record
 
SubmitForm(EditForm1_2);;
Notify("Waiting for upload..."; NotificationType.Information; 5000);;


Set(newRecord; 
Patch(Angebote; Defaults(Angebote);
    {
        Titel:"Placeholder Title";
        Requestnumber:000000
    }
    )
);;

Set(TimerGo; true);;
then after that the Timer is started via a variable:
 
Duration: initially 5000 now 10000
 
OnTimerEnd property:
Set(newRecordRequestNumber; EditForm1_2.LastSubmit.Requestnumber);; //here the record gets the requestnumber from the dataverse entry

Patch(Angebote; 
    LookUp(Angebote; ID=newRecord.ID);
    {   
        ID: newRecord.ID
        Titel: "Angebotsdatei";
        Requestnumber: Value(newRecordRequestNumber)
    }; 
    Form1.Updates);;

Set(TimerGo; false);;
UpdateContext({resetAttachment: true});;
Reset(Timer1)
 
I tried assigning "ID" manually but it just doesn't make a difference.

Could you please assist me in finding what is causing the error and fixing it? In my understanding the field "Id" is first of all called "ID" in the sharepoint List and also it is an autogenerated number which is created by default from Sharepoint.

Thanks and kind regards
Saki

 
 
  • Suggested answer
    timl Profile Picture
    timl 31,933 on 29 Nov 2024 at 10:52:41
    Network error when using patch function field "Id" is required - but Id is an autogenerated number
    Hi Saki
     
    The best approach is not to use a timer.  The thing that's probably happening is that the call to SubmitForm takes more than 5/10 seconds in the cases where this doesn't work. The call to EditForm1_2.LastSubmit.Requestnumber therefore returns blank in these instances.

    The best thing to do this move the formula in your OnTimerEnd property to the OnSuccess property of EditForm1_2. This will only when after the record is created successfully and should hopefully resolve this problem. 
  • Saki Profile Picture
    Saki on 29 Nov 2024 at 10:25:22
    Network error when using patch function field "Id" is required - but Id is an autogenerated number
    bump

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,168

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,851

Leaderboard