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 / Unable to patch the Or...
Power Apps
Unanswered

Unable to patch the OriginalEndDate

(0) ShareShare
ReportReport
Posted on by
Hi 
I have a gallery and I am trying to patch and update the fields in the gallery.
 
I used the below code 
Reset(Inp_Cluster_Drp);
 
ForAll(
    inprogresslis As x,
    If(
        x.status = "New",
        // If the record does not exist, create a new one
        Patch(
            'FTE Draft Data',
            Defaults('FTE Draft Data'),
            {
                'Employee NO': x.'Employee NO', // Use fields from the gallery item
                'Cluster/Function': x.'Cluster/Function',
                Program: x.Program,
                'Full Name': x.'Full Name',
                'Budget Code': x.'Budget Code',
                'FTE(%)': x.'FTE(%)',
                OriginalEndDate: If(
                    IsBlank(x.OriginalEndDate) || Len(x.OriginalEndDate) <> 10,
                    Blank(), // Leave blank if the date format is incorrect
                    Date(
                        Value(Mid(x.OriginalEndDate, 7, 4)),  // Year
                        Value(Mid(x.OriginalEndDate, 4, 2)),  // Month
                        Value(Left(x.OriginalEndDate, 2))     // Day
                    )
                ),
                'Month and Year': x.'Month and Year'
            }
        ),
        // If the record exists, update the existing one using ThisRecord directly
        Patch(
            'FTE Draft Data',
            LookUp('FTE Draft Data', ID = x.rowno), // Update the current item in the gallery
            {
                'Budget Code': x.'Budget Code', // Refer to combo box selection
                'FTE(%)': x.'FTE(%)',
                OriginalEndDate: If(
                    IsBlank(x.OriginalEndDate) || Len(x.OriginalEndDate) <> 10,
                    Blank(), // Leave blank if the date format is incorrect
                    Date(
                        Value(Mid(x.OriginalEndDate, 7, 4)),  // Year
                        Value(Mid(x.OriginalEndDate, 4, 2)),  // Month
                        Value(Left(x.OriginalEndDate, 2))     // Day
                    )
                )
            }
        )
    )
);
 
Refresh('FTE Draft Data');
ClearCollect(FTECollection, 'FTE Draft Data');
 
// Show success notification after the patch operations
Notify("Records Saved to Draft Successfully", NotificationType.Success, 3000);
Set(vboolflag, true);
Clear(inprogresslis);
 
please guide me how to fix it.
 
I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 525 Most Valuable Professional

#2
Haque Profile Picture

Haque 273

#3
Kalathiya Profile Picture

Kalathiya 232 Super User 2026 Season 1

Last 30 days Overall leaderboard