You need to sign in to do that
Don't have an account?
Design pattern to share a variable across all community pages
Hello everyone
I have a community with different pages. The community might be used in different countries so it will have some functionalities that are available in some cases but not in others (for example open current discounts).
I have a custom metadata type with records for each country where the settings for different functionalities are stored - for example
UK - open current discounts - true
US - open current discounts - false.
Is there a way to get that information only once (I call an apex class that makes a query for the metadata) and set it for the session, so that all pages can use it or I have to call the method from each page.
You could use a Single Page Application pattern. This link might help you to start: https://www.geeksforgeeks.org/what-is-spa-single-page-application-in-angularjs/
Hi Michael,
Thanks for the reply, but I do not want to integrate a third party app builder like Angular or React. From what I understand every page in the community builder is separate. You set header, content and footer components, but I do not see a general state store like Redux in React for example to link different pages.
I understand. I don't this is possible because the way that natively SF provides is apex:composition (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_composition.htm), and this could help to reuse some HTML but not server calls.
Maybe considering going with LWC in VF could help, take a look at this if it helps: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_composition.htm
I hope this helps