getValue()
The getValue() function (client-side and server-side) retrieves the value associated with a specific answer.
Syntax
Use this syntax for the getValue() function:
getValue('QUESTION_CODE', 'ANSWER_CODE');
Return Value
The getValue() function returns a string corresponding to the value stored in the answer, or false if no value has been provided. For dropdown lists, checkboxes, and radio buttons, the function returns either true or false.
Parameters
Required parameters:
-
QUESTION_CODE -
ANSWER_CODE
The getValue() function accepts the following parameters:
-
QUESTION_CODE(string) - Specifies the code of the question for which you want to retrieve the answer value. You can find it in the Code field on the question record. -
ANSWER_CODE(string) - Specifies the code of the answer for which you want to retrieve the value. You can find it in the Code field on the answer record.
Examples
The following examples show how to use the getValue() function.
Retrieving the Answer Value
In this example, the getValue() function retrieves a text box answer entered by a user during configuration. This is useful for retrieving user-entered notes or comments.
const value = getValue('SHIPPING_INPUT_BOX', 'DELIVERY_COMMENT_BOX');
console.log(value);
The resulting output may look like this:
For the delivery, use the code 2345 to open the gate.