0

I am integrating SalesForce with a third party app and I would like to have the URLs go to the sandbox url of the third party app in my sandbox environment and I would like them to go to the prod version in the production instance of SalesForce.

I am aware that SalesForce provides the isSandbox field for the Organization object ($Organizatin.IsSandbox).

I am also aware that they have custom setting (List and Hierarchy)

However, when I am attempting to get the isSandbox value in the formula field of the Hierarchy settings it isn't available.

It seems like the only way for me to accomplish this right now would be to either:

  1. Create 1 custom setting, have my Apex reference that custom setting, and then go in and change the values in sandbox/prod to make sure the correct values are there for the respective env

  2. Create 2 custom settings (Custom_Settings_Sandbox and Custom_Settings_Prod) that have the same field names with different values and then wherever they are needed in the code have an if statement that gets the proper one based on the isSandbox value from the Organization object

My question is, are these the only two options I really have? Is there no way for me to get the isSandbox value in the Hierarchy settings? I am sorry if this is a bad question, it just seems like there has to be a more elegant way to handle this built in.

0

1 Answer 1

2

Custom settings are not the right vehicle for this since list custom settings are deprecated and their records cannot be packaged, since they are data.

Instead use a customer metadata type, with the fields you need. Records of this type can be packaged if required, or can be part of change sets etc.

Have as many records as you need created from this CMT, one per environment, with the values you need and names appropriate to the environments represented.

In the "code" that reads the details, select the correctly named one for the environment in use.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .