Skip Navigation
Expand
Creating and using system and answer variables
Answer ID 415   |   Last Review Date 07/22/2019

What are variables and how are they created and used?

Environment:

System and Answer Variables
Oracle Service Cloud, All versions

Resolution:

In Oracle Service Cloud, there are two types of variables -- user-defined answer variables that can be included in answers and system variables than can be used with incidents and standard text responses.


System Variables

System Variables are defined within the Oracle Service Cloud application. System variable return specific values from the database fields and tables for incidents, contacts, or organizations.

For example, the database field "Contacts - First Name" can be used when responding to incidents directly or used within a standard text response.

System variables allow you to personalize standard responses by including specific values pertinent to the incident, contact or organization record. For more information on using system-defined variables, refer to Answer ID 1280: Personalizing automated incident responses.

You can include system variables within a standard text response. Then, you can use rules to append the standard text to incident responses.

Note:  You can also use rules to append standard text to the incident Notes field.  When standard text are appended to the Notes field, system variables within the standard response remain as system variables and are not replaced with the actual database value. System variables included in the Response field are resolved to display the database value.


 Custom (Answer) Variables

Answer variables are user-defined "short cuts" that allow a staff member to enter the variable instead of a longer string of text when creating or editing an answer. Variables can be entered in the Question and Answer fields of an answer.

You can use variables in both answers and incidents. When the incident is saved, the variable is converted so that the content of the variable is saved within the incident.  The content of the variable is what is sent and visible to your end-users. 

Using answer variables not only saves time by using a short cut for the longer text string, but it also eliminates typographical and spelling errors that may occur. In addition, if the text associated with the variable were to change, you could simply edit the value of the variable so that the text would be updated all at once without having to edit each answer separately.

When adding or editing an answer, to use the variable you create, type a dollar sign followed by the variable name, such as $CONTACT. When you save the answer, the variable is replaced with the assigned value specified in the var2intf table. For example, a variable named osvc could be created so that when $osvc is entered into an answer, the words Oracle Service Cloud are displayed.


Naming Considerations
You can search on the variable name to find the answers that contain that variable. For example, if you have a variable named ADRS that defines the mailing address for your company, you can search on ADRS to find all the answers that include that variable. For this reason, when creating variables, you may want to use names that are not actual words or commonly used acronyms. This allows you to easily find answers that contain the variable. If you use a variable with the name ADDRESS, when you search on that variable, you will get all answers that contain the ADDRESS variable along with any other answers that include the word "Address".


HTML in variables
You can include HTML code in variables.  You must enter the actual code within the Value field of the variable.  That is, if you wish to include a link within a variable, you must include the a href HTML tag similar to: <a href="url_of_interest.com">Link text</a>.  Similarly, if you wish to bold specific words in the variable, you must include the <b> and </b> tags around the word.

One caveat to using HTML in a variable is the management of a conditional section using variables.  Once the conditional section is started the rest of the answer will be hidden because the ending of the conditional, when used in a variable, is also hidden and thus unable to process the ending of the conditional section.  To learn more about conditional sections within an answer please view Adding conditional sections to published answers.

 

Displaying $ in Text Strings
If the character immediately following a $ sign is numeric, the character sequence is NOT treated as a variable. This means that monetary units can be entered as normal.


Managing Variables 

You can manage your answer variables for all interfaces while being logged in to one interface. The Interface drop-down menu allows you to select which interface you are defining the variable for.

When you change the Interface menu, the variable that is used for that interface displays in the text area field. This allows you to use one variable across multiple interfaces, but define specific content for each interface.

If the text area field is blank, then the variable is not defined for that interface and the variable will not render on the end-user pages of that interface.

If you are using the same variable content across multiple interfaces, you must copy and enter the content for each interface value.

For example, you can have a variable named COMPANY that uses the content "Company A" for one interface and "Company B" for another interface. That way, when the variable is used in an answer, the correct company name will display when viewed from the end-user pages for that interface.

You can also specify whether your answer variable should be indexed or not. For more information regarding indexing, refer to Answer ID 1266: Impact of Indexing a Custom Field.

To add an answer variable, use the steps below:

  1. From the Service Administration items select Content Library > (Answer) Variables.

  2. Right click in the left-hand frame and select Add Variable.

  3. Enter the name of the variable in the Name text box.

  4. Select which interface you are defining the variable for.

  5. Enter the text string for the variable being defined. 

  6. If appropriate, select a different interface from the Interface menu and define the variable for another interface.

  7. Click Add.

  8. Add the variable to an answer and preview the answer to verify that it displays as you wish as defined for that interface.



For additional information, refer to the 'Add or Edit a Variable' section in online documentation for the version your site is currently running. To access Oracle Service Cloud manuals and documentation online, refer to the Documentation for Oracle Service Cloud Products.

Available Languages for this Answer:

Notify Me
The page will refresh upon submission. Any pending input will be lost.