I need to send an email using apex that contains a link for the email recipient to login to a specific community. I'd like this link to change between my sandboxes and production. What appears to me to the best way to achieve this is create a custom meta data type that is used either in a SOQL query to get the community link, or even use the custom meta data string value itself as the value for the url to login.

Do I have the right idea for what I'm trying to achieve, or is there a better way?


Since links the getting changed from Org to Org, it is better to use Custom Settings.

If the settings values are same for Org to Org then better to use Custom Metadata Types.

In both the cases, executing SOQL query doesn't count into the limit and both of them cache the data.

Also, you can think for using Platform Cache to store the link value.

So, flow will be like this:

Link retrieval

  • 1
    The other way I have seen it done is with a Custom Label but this is a better solution. – Dave Humm Mar 26 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.