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 based on an If()
Power Apps
Answered

Patch based on an If()

(0) ShareShare
ReportReport
Posted on by 25

HI all,

 

I am hoping for some help as I can't figure out where I have gone wrong with this one:

 

Creating a Name Change option on a powerapp and if the change is back dated I need an error message to show, but if today or future dated change then it needs to patch a tracker for changes to be submitted to a central team, then make the name change overlay not visible. 

 

If(    IC_NC_Dat.SelectedDate>=Today(),       
           
Patch ('Requested Changes Trackers',
                Defaults('Requested Changes Trackers'),
                {'Effective Date':IC_Eff_Dat_Pick.SelectedDate},
                {'Employee Number': varIndEmp},
                {Name: IC_NN_Home.Text},
{'Change Type': Text("Name Change")
                ) &&
                Reset(IC_Eff_Dat_Pick) && Reset(IC_NN_Home) && Set(varShowNamChan,false),


                Set (varErrMess, true));

 

I am new to powerapps still so any help is appreciated.

 

Many thanks
Cat

Categories:
I have the same question (0)
  • KitCat Profile Picture
    25 on at

    As an update I have amended some errors I have found but it has not stopped throwing the errors. Please see below for amended code:

     

    If(    IC_NC_Dat.SelectedDate>=Today(),       
               
    Patch ('Requested Changes Trackers',
                    Defaults('Requested Changes Trackers'),
                    {'Effective Date':IC_NC_Dat.SelectedDate},
                    {'Employee Number': varIndEmp},
                    {Name: IC_NN_Home.Text},
    {'Change Type': Text("Name Change")
                    ) &&
                    Reset(IC_NC_Dat) && Reset(IC_NN_Home) && Set(varShowNamChan,false),


                    Set (varErrMess, true));

  • Akser Profile Picture
    1,546 Moderator on at

    Hi @KitCat,

     

     

    If(
     IC_NC_Dat.SelectedDate>=Today(), 
     Patch(
     'Requested Changes Trackers',
     Defaults('Requested Changes Trackers'),
     {
     'Effective Date':IC_NC_Dat.SelectedDate,
     'Employee Number': varIndEmp,
     Name: IC_NN_Home.Text,
     'Change Type': "Name Change"
     }
     ),
     Set (varErrMess, true)
    );
    Reset(IC_NC_Dat);
    Reset(IC_NN_Home); 
    Set(varShowNamChan,false)

     

  • KitCat Profile Picture
    25 on at

    Hi Thanks for this - I need the reset and to make the screen not visible only if the error is not shown.

     

    Can we do that please?

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @KitCat

    If(IC_NC_Dat.SelectedDate<Today(),

    Notify("Date must be today or later", Error),
    Patch ('Requested Changes Trackers',
    Defaults('Requested Changes Trackers'),
    {'Effective Date':IC_NC_Dat.SelectedDate},
    {'Employee Number': varIndEmp},
    {Name: IC_NN_Home.Text},
    {'Change Type': Text("Name Change")
    } );
    Reset(IC_NC_Dat);

    Reset(IC_NN_Home);

    Set(varShowNamChan,false);

    Set (varErrMess, true)

    )

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

#2
11manish Profile Picture

11manish 193

#3
Valantis Profile Picture

Valantis 138

Last 30 days Overall leaderboard