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

Switch between testing and production environment

Hello, we have a scenario that we are developing a large app consists of say 10 SharePoint data sources.

Once finished, this app will be in production and widely used within my organization.

Image later someday, we want to develop a new feature on this app, while we don't want to stop or disturb our users from using the app, so what is the best practices for this?

Not publishing the app. This does not work because while the new feature is in developing, we may occasionally test it, by clicking submit, modify, or delete button, which will destory the backend data sources and affecting normal users.

 

What if we duplicate the production SharePoint lists for testing purposes? We have faced implementing issue: How can we switch between testing and production data sources effectively?

Say we have a production list named Prod1 and the corresponding duplicated testing list named Test1.

In the OnStart property of the app, we use:

Set(IsDebugging, true) // or false if we want to publish
Set(SourceRef1, If(IsDebugging, Test1, Prod1)) // use a variable to reference the underlying source

Then in the gallery control, we set its Item property to SourceRef1. It seems to work but not behave well. When we use SubmitForm to create a new record, the underlying source is updated, but the SourceRef1 is not refreshed, so we have to call this

Refresh(If(IsDebugging, Test1, Prod1))
Set(SourceRef1, If(IsDebugging, Test1, Prod1))

After each time we call SubmitForm. And not only SubmitForm, but also we have to do so for Remove, Update, Patch, or ANY function that modifies the referenced data source. And we have 10 data sources, That situation is jsut unacceptable.

We are wondering if there is any elegant way to solve this problem? I don't know if I clearly state it, you are free to ask me for further explanation.


Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Switch between testing and production environment

Hi @xilef,

Could you please share a bit more about your scenario?

Do you mean that the SourceRef1 variable could not be updated/refreshed when you submit your form every time?

How do you submit your form data on your side? Using SubmitForm() function?

Based on the info that you provided, I think your Edit form is connected to your underlying source -- Prod1 and Test1, is it true?

If you connect your Edit form to your underlying source -- Prod1 and Test1, when you click "Submit" button, the form data would be submitted to your underlying source, rather that the SourceRef1 variable (the SourceRef1 variable would not be updated automatically).

Note: Connecting variable or collection to a Edit form is not supported within PowerApps currently.

I have made a test on my side, please take a try with the following workaround:

Set the OnStart property of the first screen of your app to following:

 

Set(IsDebugging, true);
Set(SourceRef1, If(IsDebugging, Test1, Prod1))

 

Set the Items property of the Gallery (BrowseGallery1)to following:

 

SourceRef1

 

Set the DataSource property of the Edit Form control to following:

 

If(IsDebugging, Test1, Prod1)

Set the Item property of the Edit form control to following:

 

BrowseGallery1.Selected  /* <-- BrowseGallery1 represents the Gallery control in your app*/

 

Set the OnSelect property of the "Submit" button to following formula:

SubmitForm(EditForm1)

 

Set the OnSuccess property of the Edit form to following:

 

Refresh(If(IsDebugging, Test1, Prod1))
Set(SourceRef1, If(IsDebugging, Test1, Prod1))

 

 

In addition, when you delete/remove a record within your app, please set the OnSelect property of the "Delete" button to following:

 

Remove(If(IsDebugging, Test1, Prod1), BrowseGallery1.Selected);
Refresh(If(IsDebugging, Test1, Prod1));
Set(SourceRef1, If(IsDebugging, Test1, Prod1));
If(IsEmpty(Errors(If(IsDebugging, Test1, Prod1), BrowseGallery1.Selected)), Back())

 

 

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.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Switch between testing and production environment

Hi @xilef,

Could you please share a bit more about your scenario?

Do you mean that the SourceRef1 variable could not be updated/refreshed when you submit your form every time?

How do you submit your form data on your side? Using SubmitForm() function?

Based on the info that you provided, I think your Edit form is connected to your underlying source -- Prod1 and Test1, is it true?

If you connect your Edit form to your underlying source -- Prod1 and Test1, when you click "Submit" button, the form data would be submitted to your underlying source, rather that the SourceRef1 variable (the SourceRef1 variable would not be updated automatically).

Note: Connecting variable or collection to a Edit form is not supported within PowerApps currently.

I have made a test on my side, please take a try with the following workaround:

Set the OnStart property of the first screen of your app to following:

 

Set(IsDebugging, true);
Set(SourceRef1, If(IsDebugging, Test1, Prod1))

 

Set the Items property of the Gallery (BrowseGallery1)to following:

 

SourceRef1

 

Set the DataSource property of the Edit Form control to following:

 

If(IsDebugging, Test1, Prod1)

Set the Item property of the Edit form control to following:

 

BrowseGallery1.Selected  /* <-- BrowseGallery1 represents the Gallery control in your app*/

 

Set the OnSelect property of the "Submit" button to following formula:

SubmitForm(EditForm1)

 

Set the OnSuccess property of the Edit form to following:

 

Refresh(If(IsDebugging, Test1, Prod1))
Set(SourceRef1, If(IsDebugging, Test1, Prod1))

 

 

In addition, when you delete/remove a record within your app, please set the OnSelect property of the "Delete" button to following:

 

Remove(If(IsDebugging, Test1, Prod1), BrowseGallery1.Selected);
Refresh(If(IsDebugging, Test1, Prod1));
Set(SourceRef1, If(IsDebugging, Test1, Prod1));
If(IsEmpty(Errors(If(IsDebugging, Test1, Prod1), BrowseGallery1.Selected)), Back())

 

 

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.

View solution in original post

xilef
Level: Powered On

Re: Switch between testing and production environment

Thanks for your reply. That's exactly what I mean. Basically I have to use this formula:

If(IsDebugging, Test1, Prod1)

to replace each place where the underlying data source is referenced, rather than set the data source as a variable, and make use of this variable.

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,762)