Skip to main content
dinesha5713
November 20, 2024
Question

Filter Environment Specific Constant

  • November 20, 2024
  • 9 replies
  • 0 views

There are 300+ Constant in  my application but i need to filter the Env specific Constant .

How can i do that 

9 replies

davidj137213
Brainy
November 20, 2024

Could you explain a little more please?

mikes0011
Brainy
November 20, 2024

The only way I've figured out so far to distinguish Environment Specific constants from others is to manually put in a specific text tag into the Description at create/edit time, like "[ES]" or similar.  I don't know of any systematic one to distinguish them from others, other than to gather all constants into one app, export them, and see what the deployment customization file says (since it would only reference environment-specific ones).

What's your use case exactly?

November 21, 2024

One way of doing this is to have a package created for all the constants in your application and before you try to deploy the package you will have the Customization file in which all the environment specific constants will be listed out

November 22, 2024

Hi [mention:30bb505c1ca4449ca754b36b7a8ed1d7:e9ed411860ed4f2ba0265705b8793d05] 

Add all constants to a package and then export that newly created package. While downloading the exported package inside, any constants are marked as environmental constants. By default, it shows the import customization file. While downloading the import customization file in which all the environmentally specific constants will be listed out.

mathieud0001
November 22, 2024

I prefix them with ENV_

mikes0011
Brainy
November 22, 2024
I prefix them with ENV_

that's a good idea, and i'd further suggest that for those folks (like me) who would need to keep existing project-specific and/or app-specific prefixes in place, then the "ENV_" part could be added as a "secondary prefix" within the constant name, like just after the app prefix - i'd be tempted to make it slightly longer to be more specific, like "ENVSPEC_" or something, so the whole thing might look like i.e. "MYAPP_ENVSPEC_CONSTANT_NAME_HERE"

mathieud0001
November 22, 2024

Should have been more specific, I do prefix with the app name

MYAPP_ENV_CONSTANT_NAME_HERE

somasundaram.d
November 25, 2024

You have to manually filter out with any of the mentioned methods, but it is recommended to name the environment constant in an easily identifiable manner just for this case.

Start the name with the application prefix, use an additional prefix to group env constants.

APP_ENV_CONSTANT_NAME

mathieud0001
November 25, 2024

You basically replied the same thing as Mike and I.