I’ve been doing apex for about 7 years now, and along the way I discovered a few things that made my life as a developer a lot easier. I made a list of 5 things thar I wish I had known wen I just started. Those things will be explained to you in a series of 5 posts.
One of the most tiresome things to do when managing multiple applications is to keep things like templates, and security up-to-date across all applications.
Apex has a nice built-in system for this called ‘subscriptions’.
If you just start with a new project, the easiest way to set-up the subscriptions is by creating a new application and call it “MASTER APPLICATION” or something similar, so you know this will be the parent application for all subscriptions. For an existing application the same method applies, but it will be a bit more work intensive to get everything right.
In this application, you define your, security scheme, authorization schemes, templates, list of values.
Once you have your basic configuration done, you are ready to start working on your new applications.
To link the new application to the MASTER application let’s say for example an authorization scheme.
You go to shared components, authorization schemes, create.
Select “create as copy”.
Copy from the master application and then select copy and subscribe.
If you edit the authorization scheme now you will see that in the subscription part there is an application referenced.
By now you are wondering: “What’s the point of all this? Couldn’t I just as easily have copy pasted the code?”
Yes, you could have, but imagine having 20 or more applications using the same authorization scheme, and then one day you may have to change something inside, you would have to modify all 20 schemes in all 20 applications again.
But because now we reference the master template this is no longer necessary. For instance let’s say we want a function to return false instead of true, what we can do now is go to the master application, edit the authorization scheme, change it, save it, and press the publish scheme button.
In the long run this could save you tons of work!
For subscribing templates in apex there is a way to do all templates at the same time.
Go to shared components, templates.
On the righthand side you have a menu called task, click the link to replace templates in this application with templates from another application.
Select the master application again, in the next screen select the template, and in the action drop down select, replace/subscribe, and press replace templates.