- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 04:24 PM
Hi.
I Created Client Script.
When the first 2 digits of the display value of the test field is ZZ, the process of setting the value of the main field to other is described.
But, it doesn't work.
Because getDisplayValue ('field_name'). Value can only use Reference Type fields.
Is there a g_form to get the displayed value of String Type(Setting Choice)?
Thank you!
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var string = g_form.getDisplayBox('test').value;
if (string.indexOf('ZZ') !== 0) {
g_form.setValue('main', 'other');
} else if (string.indexOf('91') !== 0) {
g_form.setValue('main', 'internal');
}
}
Solved! Go to Solution.
- Labels:
-
Script Debugger
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 06:35 PM
I've created a field name "u_test" with label "New Choice" on an incident form.
Created a onChange script on Field "New Choice"
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var value = g_form.getValue('u_test');
var text = g_form.getOption('u_test', value).text;
alert("getOption:" + text);
}
Execution result when Choice 1 is selected.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 06:18 PM
What is the type of field "test"? Is is a choice field, a string, or a reference?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 06:21 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 06:24 PM
What is the name of the drop-down list?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 06:28 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2022 06:35 PM
I've created a field name "u_test" with label "New Choice" on an incident form.
Created a onChange script on Field "New Choice"
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var value = g_form.getValue('u_test');
var text = g_form.getOption('u_test', value).text;
alert("getOption:" + text);
}
Execution result when Choice 1 is selected.