cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
R3dKap
Super User
Super User

Global or context variable unchanged if page not refreshed

On a SharePoint list where I customized the form using Powerapps:

  1. I select item ID 1 and click MODIFY
  2. The Powerapps form starts and sets a global (or context) variable A to FALSE in the OnStart or OnVisible event of the screen
  3. In the form I click on a button which sets A to TRUE
  4. I close the form by clicking on CANCEL
  5. I select item ID 2 and click MODIFY
  6. My variable A is still TRUE -> OnStart and OnVisible events do not re-trigger if the web is not refreshed

 

Anyone knows a way around this ? I would like to do things every time a form is displayed even if I don't refresh the page but just go from one list item to another...

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Thorpe
Super User
Super User

I believe this is a bug and I can reproduce it in my environment. I think I have a work around. I tried this in my environment and it seem to work. Move your variable to the OnVisible property of the screen then add "Navigate(FormScreen1, ScreenTransition.None)" to the OnNew, OnEdit and OnView properties of the SharePointIntegration control.

 

OnView Example: ViewForm(SharePointForm1); Navigate(FormScreen1, ScreenTransition.None)

 

By adding the Navigate() it appears to trigger the OnVisible property which will then reset your variable.

 

@dinusc, @v-monli-msft, @v-xida-msft or @v-micsh-msft,

Can you verify that this is a bug and if so, send it to the product team?



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
Jeff_Thorpe
Super User
Super User

I believe this is a bug and I can reproduce it in my environment. I think I have a work around. I tried this in my environment and it seem to work. Move your variable to the OnVisible property of the screen then add "Navigate(FormScreen1, ScreenTransition.None)" to the OnNew, OnEdit and OnView properties of the SharePointIntegration control.

 

OnView Example: ViewForm(SharePointForm1); Navigate(FormScreen1, ScreenTransition.None)

 

By adding the Navigate() it appears to trigger the OnVisible property which will then reset your variable.

 

@dinusc, @v-monli-msft, @v-xida-msft or @v-micsh-msft,

Can you verify that this is a bug and if so, send it to the product team?



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
v-xida-msft
Community Support
Community Support

Hi @R3dKap,

 

Could you please share a bit more about your scenario?

 

I have made a test and the issue is confirmed on my side. 

 

There are some things to keep in your mind when you customize forms:



"The properties for the SharePointIntegration control may not be available in OnStart or OnVisible, and those events execute only once while the list is loaded. You can use OnNewOnView, or OnEdit formulas to run logic before the form is shown to the user every time"

 


 

More details about the things that you need to keep in mind when customizing forms, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/sharepoint-form-integration#customize-t...

 

In other words, the OnStart or OnVisible property could only be fired once when you edited your list (Just when you edit your list firstly), when you clicked the "Cancel" button, it just hide the custom list form rather than close the custom list form.

 

As an alternative solution, you could consider take a try to initialize/set a global variable within the OnEdit property of the SharePointIntegration control:

 

Set OnEdit property of the SharePointIntegration control to following formula:

EditForm(SharePointForm1);Set(VariableA,false)

1.JPG

 

Set the OnSelect property of the Button control to following formula:

Set(VariableA,true)

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Oh boy ! You maide my day ! Thank you so much... It works fine !

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,312)