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 / When I click on a butt...
Power Apps
Answered

When I click on a button ,it should navigate to current user's editscreen,which the user has had a record in database . otherwise ,it should navigate a new form of editscreen .

(0) ShareShare
ReportReport
Posted on by 190

Dear all

There is a button on the home page of an App.  

When I click on it ,it should navigate to current user's editscreen,which the user has had a record in database . otherwise ,it should navigate a new form of editscreen . 

How can  I configure it ? Thanks.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,378 Most Valuable Professional on at

    @GGG666 ,

    Assuming you have the user's email address in a field (I will call it UserMail below), you would do something like this

    With(
     {
     wMail:
     Lookup(
     YourListName,
     UserMail = User().Email
     )
     },
     If(
     IsBlank(wMail.UserMail),
     NewForm(YourFormName),
     Set({varID,wMail.ID);
     EditForm(YourFormName)
     )
    );
    Navigate(YourFormScreenName)

    The Item of your Form would be

    LookUp(
     YourListName,
     ID=varID
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • GGG666 Profile Picture
    190 on at

    GGG666_0-1640838645548.png

     

  • WarrenBelz Profile Picture
    155,378 Most Valuable Professional on at

    @GGG666 ,

    Is UserMail your actual field name with the user's email address? I only used it as an example.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • GGG666 Profile Picture
    190 on at

    hi  

    I have no field for email .

    I  have a column that is a person/group type 

  • Verified answer
    WarrenBelz Profile Picture
    155,378 Most Valuable Professional on at

    @GGG666 ,

    Then you need this

    With(
     {
     wMail:
     LookUp(
     YourListName,
     YourPersonField.Email = User().Email
     )
     },
     If(
     IsBlank(wMail.ID),
     NewForm(YourFormName),
     Set(varID,wMail.ID);
     EditForm(YourFormName)
     )
    );
    Navigate(YourFormScreenName)

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • GGG666 Profile Picture
    190 on at

    Thanks, Though  ,it doesn't work

    GGG666_0-1640853926402.png

    GGG666_1-1640853971612.png

     

  • GGG666 Profile Picture
    190 on at

    the filed named as Employee

  • Verified answer
    WarrenBelz Profile Picture
    155,378 Most Valuable Professional on at

    @GGG666 ,

    I have now updated it with your values

    With(
     {
     wMail:
     LookUp(
     'Home working schedule',
     Employee.Email = User().Email
     )
     },
     If(
     IsBlank(wMail.ID),
     NewForm(EditForm1),
     Set(varID,wMail.ID);
     EditForm(EditForm1)
     )
    );
    Navigate(EditScreen1)

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Verified answer
    GGG666 Profile Picture
    190 on at

    Hi  ,

    The code is alright. Though , as soon as i click on the button , it still display other's record .

    And i  add the other code in the item filed of the form. .But the varID is unidentifiable. Thanks.

    GGG666_2-1640910766884.png

     

  • Verified answer
    WarrenBelz Profile Picture
    155,378 Most Valuable Professional on at

    Hi @GGG666 ,

    Initialise it at App OnStart

    Set(varID,0)

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard