Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel
nameblue

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

 

What does this section cover?

Table of Contents

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.

Code Block
languagexml
titlevariables.xml
collapsetrue
<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.

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