Hi,
We have a canvas app that uses SharePoint as the backend that has a dev, staging and production version across three environments. We have a single SharePoint site that each environment saves to and have been using a column to filter out data between each environments app/flows.
As part of an upgrade to our app we have created three separate SharePoint sites so each environment will connect to its own. All data sources in the app and all SharePoint connections in our flow point to environment variables. The intention being that when we make a change and push it through our environment's we only have to amend each environments, environment variables and everything is good to go.
In the future we plan to add several additional production versions of the app with their own SharePoint sites to cater to different teams.
Unfortunately we have been running into several issues, while I have most things worked out, I wouldn't mind some feedback on whether this is the correct approach and am just posting this for other users. We do not want to end up in a situation where each change we make to the app in dev requires extensive modifications per environment to get up and running.
Our setup
Environment Variables
One master variable to store that environments related SharePoint site. A variable per SharePoint list that uses the master variable for the site and points to the appropriate list under that site
Canvas app
Each data source is uses that master variable, then points to the related list environment variable.
Flows
Each SharePoint action uses the master variable, then the appropriate list environment variable, no SharePoint actions are directly pointed to SharePoint.
What we expected
When exporting the solution from dev as a managed solution, we import it into staging or prod and that it prompts or allows us to update the environment variables. Once all environment variables point to the site related to that environment. The app and flows work without issue.
What's happening
Environment variables
When importing we were not prompted, attempted removing the current value of each environment variable and re-importing with no luck. We could not amend the environment variables within the solution as it was managed.
Fix -
- Going to the default solution and amending them there - worked after lots of trial and error, ended up having to delete the solution from staging and re-importing it then modifying the environment variables, but that may be due to all the messing around I was doing. Hopefully modifying the default solution in the future just works.
Canvas app
After amending the environment variables then playing the canvas app only some data sources were pointing to the staging SharePoint site, with others pointing to the dev one, despite them using an environment variable that was pointing to staging.
To further test, back in dev I removed all data sources, re-added them via the site environment variable and re-exported then app and imported into staging with the same result.
Fix - Once in staging remove all data sources from the app and re-add them via the master site environment variable.
Flow
One of our PowerApps triggered flows was erroring, the 1st action that connects to SharePoint using the site environment variable and list environment variable errored, in the error log it was pointing to the dev site and not staging which the environment variable has been set to.
Fix - Started randomly working after about an hour...