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 :
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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard