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 / Patch to Sharepoint
Power Apps
Unanswered

Patch to Sharepoint

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

I am trying to build application where I can patch data from PowerApps to SharePoint on job progress.

Any help is highly appreciated.

The application intention is very simple to make a production output entries, when we register 1st time a batch no, product, equipment ,process with start time - it creates a new registry. then when we patch again, it finds the previous start registry and enters the finish time.

and to create multiple registry for the same process the same day.  

Can you suggest me what should I improve in my formula? to get such result.

Any help is highly appreciated.

2.JPG

Start & Finish time in PowerApps has this code on text filter 

glbRo.Start
glbRo.Finish

with this code it is not updating the finish time either on the SharePoint or on the app

 

6.JPG

Button on select property was this

 

With({dataItem: // Your Record
 LookUp(SortByColumns(Test_MDP, "Start", Descending), 
 Product = Process_dropdown.Selected.Value && 
 Equipment= Equipment_dropdown.SelectedText.Value &&
 Process = Process_dropdown.SelectedText.Value &&
 Batchno = Batchno_Textinput.Text
 )},
 With({newTrue: // Your criteria for a new record
 (IsBlank(dataItem.Start) && IsBlank(dataItem.Finish)) || 
 (!IsBlank(dataItem.Start) && !IsBlank(dataItem.Finish))
 },

 // Your Patch to the DataSource
 Set(glbRo,
 Patch(Test_MDP,
 If(newTrue, Defaults(Test_MDP), dataItem),
 { Product : Product_dropdown.SelectedText.Value,
 Equipment:Equipment_dropdown.SelectedText.Value,
 Process : Process_dropdown.SelectedText.Value,
 Batchno : Batchno_Textinput.Text
 },
 If(newTrue, {Start:Now()}, {Finish:Now()})
 )
 )
 )
 ) 

 

when i use this code i am not getting the finished time updated after lookup on the same registry.

instead i see i get new registry with start time as new line

7.JPG

Any help is highly appreciated. Thanks in advance.

Categories:
  • C-Papa Profile Picture
    1,836 on at

    Hi, if you change If(newTrue, Defaults(Test_MDP), dataItem), to {ID: dataItem.ID}, if the ID exists it will update it, if it doesn't it will add it as a new record. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @C-Papa & All,

     

    I tried to use this code, but still it din't work and i got some new error on Start & Finish columns in powerapps. It stopped showing the registered time on app. & in sharepoint it is still registering as a new line for every single patch.

    Start & Finish time in PowerApps has this code on text filter

    glbRo.Start
    glbRo.Finish

    8.JPG9.JPG New code used is here

    With({dataItem: // Your Record
     LookUp(SortByColumns(Test_MDP, "Start", Descending), 
     Product = Process_dropdown.Selected.Value && 
     Equipment= Equipment_dropdown.SelectedText.Value &&
     Process = Process_dropdown.SelectedText.Value &&
     Batchno = Batchno_Textinput.Text
     )},
     With({newTrue: // Your criteria for a new record
     (IsBlank(dataItem.Start) && IsBlank(dataItem.Finish)) || 
     (!IsBlank(dataItem.Start) && !IsBlank(dataItem.Finish))
     },
    
     // Your Patch to the DataSource
     Set(glbRo,
     Patch(Test_MDP,
     {ID: dataItem.ID},
     { Product : Product_dropdown.SelectedText.Value,
     Equipment:Equipment_dropdown.SelectedText.Value,
     Process : Process_dropdown.SelectedText.Value,
     Batchno : Batchno_Textinput.Text
     },
     If(newTrue, {Start:Now()}, {Finish:Now()})
     )
     )
     )
     ) 

    Any help is highly appreciated. 

  • C-Papa Profile Picture
    1,836 on at

    I'm not sure if With is the correct function for this. its difficult to tell without seeing all of you application. also, sort isn't required as LookUp only returns one item - there is nothing to sort.  try the below as this is how i would do it. 

     

    Set(dataItem,LookUp(Test_MDP,Product = Process_dropdown.Selected.Value && Equipment= Equipment_dropdown.SelectedText.Value && Process = Process_dropdown.SelectedText.Value && Batchno = Batchno_Textinput.Text))

     

    ;Set(newTrue, IsBlank(dataItem.Start) && IsBlank(dataItem.Finish) || !IsBlank(dataItem.Start) && !IsBlank(dataItem.Finish))


    ;Set(glbRo, Patch(Test_MDP, {ID: dataItem.ID}, {Product : Product_dropdown.SelectedText.Value,
    Equipment:Equipment_dropdown.SelectedText.Value, Process : Process_dropdown.SelectedText.Value,
    Batchno : Batchno_Textinput.Text},If(newTrue, {Start:Now()}, {Finish:Now()}))

    i would separate these 3 formulas into 3 buttons to make sure each one works individually and then press them all in order. you need to make sure that dataItem is returning a record to allow the patch to work

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 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
timl Profile Picture

timl 122 Super User 2026 Season 2

Last 30 days Overall leaderboard