cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
navneet7326
Regular Visitor

Change data source of the the form/gallery at run time by passing site url in query string parameter

Hi Team,

 

I want to implement a scenario where i have multiple SharePoint sites with Same Schema. (count is more than 50 sites)

 

I have a list "Products" on every SharePoint Site (Same schema again).

 

I have created a power app to enter data in this list on one of the site.

 

Wanted to know that if i provide power app URL on a page with query string parameter as my current site URL, it is possible to change form/gallery data source/list pointing to that site only.

 

so that when user is going to site A then should be able to enter data in products list of site A.

and when user is going to site B then should be able to enter data in products list of site B.

 

Note: I am planning to pass Site URL in query string parameter.

 

Is it feasible?

 

Awaiting to get inputs on this.

 

Thanks,

Navneet

3 REPLIES 3
RandyHayes
Super User
Super User

@navneet7326 

No, you cannot do this in PowerApps as you describe.  It expects to have its datasources defined in the app.  So you would either need 50 version of the app, or simply have all 50 site Product lists as datasources in your app.

 

However, this goes beyond just having them in the app.  You cannot switch out the datasource of controls like galleries or editforms easily.

For EditForms, you would need to essentially have 50 edit forms that would be visible or not based on which list you are working with.

For Galleries, you can use a Switch function to determine which datasource you are getting data from, but be careful as the schemas need to match, or you need to extrapolate a common set of columns for each in your Items formula.

 

So...the short answer is, Yes,  you can use the methods above to do it.  There will just be some repetition and you will also want to make sure that users of the app have access to all of the lists.  Even though they might not be interacting with other lists (based on the site info passed in), the app will still want to connect to them and if there is no access, then they will see a slew of error notifications....not so nice.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thanks for your detailed response on this with clarification.

Limitation with my requirement is that sites count can keep on increasing once a user provisioned a site.

Also, users will be unique across different sites.

 

Looks like this is not feasible in my case.

 

Thanks again for the help.

RandyHayes
Super User
Super User

@navneet7326 

Not easily achievable in that situation. 

Not knowing the amount of data you have on each site, the only other I can imagine would be to centralize the data to a central list that contains the data from each site.  This is something that PowerAutomate could assist with in duplicating records and changes between all the locations.  Then in your app, simply filter the central list by a column in your central list that would contain the site name.

Not all that great, but it would be pretty flexible at least.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,760)