cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WilliamVingaard
Level: Powered On

Timing issues with On Visible

Hi,

In alot of business scenarioes its important to know what values the fields in a Custom SharePoint form had initialy, and then being able to compare it to values once the form is saved. I use this often to fire notification workflows, instead of using the "On modified" Flow trigger.

With designer and classic sharepoint, this was mostly solved by using a hidden log field, and setting the value of this field to the visible field, and then these could be compared in the designer workflow.

With PowerApps and the availability of variables, we can avoid this log field and workflow logic.

This issue i am running into, is that it seems, when using the On visible value to set the variables, the data isnt loaded yet, so the variables stays empty. 

I have solved this with a hidden timer, that waits 2 seconds before setting the variables. This works but I just wanted to know if some else have found a better solution for the timing issues with data sources not loading the data instant on visible.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: Timing issues with On Visible

Hi @WilliamVingaard ,

Do you mean that the variable could not be loaded fast enough in your custom form?

 

Based on the issue that you mentioned, I have made a test, please consider take a try with the following workaround:

please set the OnNew property of the SharePointIntegration control to following:

Set(Variable1, "value1");   /* <-- Set your variables here. These variables would be set when you load a New Form via clicking "+ New" in your SP List  */
Set(Variable2, "value2");
...
Refresh('YourSPList'); /* <-- Add formula here */ NewForm(SharePointForm1)

If you want to set variables when you edit a form, please consider set the OnEdit property of the SharePointIntegration control to following:

Set(Variable1, "value1");   /* <-- Set your variables here. These variables would be set when you edit a form via clicking "+ New" in your SP List  */
Set(Variable2, "value2");
...
Refresh('YourSPList'); /* <-- Add formula here */ EditForm(SharePointForm1)

set the OnView property of the SharePointIntegration control to following:

Refresh('YourSPList');     /* <-- Add formula here */
ViewForm(SharePointForm1)

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

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.

View solution in original post

Community Support Team
Community Support Team

Re: Timing issues with On Visible

Hi @WilliamVingaard ,

Have you solved your problem?

 

Actually, the Network state would also affect the execution speed of the functions in PowerApps canvas app. Please make sure your Network is in a good condition.

 

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

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.

View solution in original post

5 REPLIES 5
Community Support Team
Community Support Team

Re: Timing issues with On Visible

Hi @WilliamVingaard ,

Could you please share a bit more about your issue?

Do you create a custom form using PowerApps within your SP List?

Further, do you want to initialize/set a variable when you open a new form (click "+ New" button)?

 

Based on the issue that you mentioned, I suppose that you created a custom form using PowerApps in your SP List, is it true?

 

According to the issue that you mentioned, I think this issue may be related to the OnVisible property of the FormScreen.

If you created a custom form using PowerApps within your SP List, there are some limits on OnStart property and OnVisible property you need to know. The OnStart property and OnVisible proeprty of the FormScreen would be executed only once while the list is loaded.

In other words, when you load your custom form in your SP List first time, the OnStart property and OnVisible property would be fired. Then when you load the form again to create another new record, the OnStart property and OnVisible property would not be fired again.

Please check the following article for more details:

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

 

As an alternative solution, you could consider set your variables within the OnNew property of SharePointIntegration control. On your side, please set the OnNew property of the SharePointIntegration control to following:

Set(Variable1, "value1");   /* <-- Set your variables here. These variables would be set when you load a New Form via clicking "+ New" in your SP List  */
Set(Variable2, "value2");
...
NewForm(SharePointForm1)

If you want to set variables when you edit a form, please consider set the OnEdit property of the SharePointIntegration control to following:

Set(Variable1, "value1");   /* <-- Set your variables here. These variables would be set when you edit a form via clicking "+ New" in your SP List  */
Set(Variable2, "value2");
...
EditForm(SharePointForm1)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

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.
WilliamVingaard
Level: Powered On

Re: Timing issues with On Visible

Thanks for the suggestion, but unfortunately the same timing issues are still present. If I use View item or use the Edit button diretly in the list(not in the form), the data isnt loaded fast enough and the variable stays blank or on the previously selected item.

 

Community Support Team
Community Support Team

Re: Timing issues with On Visible

Hi @WilliamVingaard ,

Do you mean that the variable could not be loaded fast enough in your custom form?

 

Based on the issue that you mentioned, I have made a test, please consider take a try with the following workaround:

please set the OnNew property of the SharePointIntegration control to following:

Set(Variable1, "value1");   /* <-- Set your variables here. These variables would be set when you load a New Form via clicking "+ New" in your SP List  */
Set(Variable2, "value2");
...
Refresh('YourSPList'); /* <-- Add formula here */ NewForm(SharePointForm1)

If you want to set variables when you edit a form, please consider set the OnEdit property of the SharePointIntegration control to following:

Set(Variable1, "value1");   /* <-- Set your variables here. These variables would be set when you edit a form via clicking "+ New" in your SP List  */
Set(Variable2, "value2");
...
Refresh('YourSPList'); /* <-- Add formula here */ EditForm(SharePointForm1)

set the OnView property of the SharePointIntegration control to following:

Refresh('YourSPList');     /* <-- Add formula here */
ViewForm(SharePointForm1)

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

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.

View solution in original post

WilliamVingaard
Level: Powered On

Re: Timing issues with On Visible

Thanks. It seems the refresh function did fix most of the issue. I can still rapidly click between items to produce the issue, this happens only in viewform, so the following edit button will set the variable correctly. 

 

 

Community Support Team
Community Support Team

Re: Timing issues with On Visible

Hi @WilliamVingaard ,

Have you solved your problem?

 

Actually, the Network state would also affect the execution speed of the functions in PowerApps canvas app. Please make sure your Network is in a good condition.

 

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

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.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,181)