cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Greg-au
New Member

Clear form viewer when starting the app

Hi Everyone,

Teaching myself powerapps and want to create a simple add new user request. The app is connected to SharePoint Online List.

I have a home screen with a button to start the new user request and below it is a form viewer that I want to be not visible on start but when the request is submitted shows the latest list entry which should be the one the user just entered.

On the FormViewer Item field I have - Last(Sort('New Users',ID,Ascending)). This gives me the latest user created but it carries over to the next time the app is started.

 

Any advice would be appreciated.

 

FormViewerFormViewer

1 ACCEPTED SOLUTION

Accepted Solutions

@Greg-au 

You can use a context variable to either true or false as the result of a condition.   If you want it hidden by default, then in the OnVisible property of the  Screen containing the Viewform put

 

UpdateContext({visvar:false})

 

Then set the Visible property of the FormViewer to visvar. 
The SubmitForm icon should never have anything other than SubmitForm(FormX) as its OnSelect property.  The OnSuccess property of the form itself is be used to change the context variable.  This formula should be in the OnSuccess property of the form

 

UpdateContext({visvar:true})

 

That way, the form would not be shown unless the form was successfully submitted.  As soon as the data is successfully submitted, the View form would be unhidden.  If you had an Edit form on the same screen, then the Edit form Visible property would be set to !visvar.  That would toggle the View form and and Edit form so either one or the other was hidden when the other form was visible. 

Another trick is to create a toggle button that hides and unhides the forms.  The OnSelect property of a button or Icon with the formula

UpdateContext({visvar:!visvar})

would do that.  

  

View solution in original post

3 REPLIES 3
Drrickryp
Super User II
Super User II

@Greg-au 

To avoid delegation problems you want First(Sort('New Users',ID,Descending)).  Your formula will max out at 2000 names (if you have increased File>Settings>Advanced Settings>Data row limit to 2000 from the default of 500.  

@Drrickryp , Thanks for responding and will look at that change.

Any advice on how to have the formviewer not visible until a user has submitted a request?

By default I have FormViewer1 set to visible=false

I was looking at the submit form icon and trying to figure out how to then set FormViewer1 to visible to show/confirm what they just requested.

I have tried SubmitForm(EditForm1); FormViewer1.Visible=true

Any thoughts

@Greg-au 

You can use a context variable to either true or false as the result of a condition.   If you want it hidden by default, then in the OnVisible property of the  Screen containing the Viewform put

 

UpdateContext({visvar:false})

 

Then set the Visible property of the FormViewer to visvar. 
The SubmitForm icon should never have anything other than SubmitForm(FormX) as its OnSelect property.  The OnSuccess property of the form itself is be used to change the context variable.  This formula should be in the OnSuccess property of the form

 

UpdateContext({visvar:true})

 

That way, the form would not be shown unless the form was successfully submitted.  As soon as the data is successfully submitted, the View form would be unhidden.  If you had an Edit form on the same screen, then the Edit form Visible property would be set to !visvar.  That would toggle the View form and and Edit form so either one or the other was hidden when the other form was visible. 

Another trick is to create a toggle button that hides and unhides the forms.  The OnSelect property of a button or Icon with the formula

UpdateContext({visvar:!visvar})

would do that.  

  

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,117)