Customize Variables Metadata

Variables metadata file is used to define the global variables of the system.

 

What does this section cover?

Variables file

All custom variables are declared in variables.xml file, which must be created under <custom_project>/web/WebContent/metadata directory.

Define Custom Variables

To define a new custom variable you have to use a unique variable name.

variables.xml
<variableconfig>
	<variables>
		<variable>
			<name>myvariable</name>
			<value>testvalue</value>
			<description>This is a test variable.</description>
		</variable>
	</variables>
</variableconfig>

Retrieve Custom Variable Values

To retrieve the variable value, you must use getVariable(String variableName, String context, String organisationID) method of com.crm.framework.metadata.MetadataUtil class.

getVariable
public void myMethod() throws Exception{
	// variableValue = "testvalue"
	String variableValue = MetadataUtil.getVariable("myvariable", getCRMSession().getRealPath(), getOrganisationID());
	...
}