- 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 05:24 PM
Hi
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var vString = g_form.getDisplayValue('test').toString();
if (vString.indexOf('ZZ') != 0) {
g_form.setValue('main', 'other');
} else if (vString.indexOf('91') != 0) {
g_form.setValue('main', 'internal');
}
}
Please check and Let us know.
Thanks 🙂
Shakeel Shaik 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 06:06 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 05:55 PM
Need to do the following to get display of choice field named "test".
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var string = g_form.getValue('test').value;
var text = g_form.getOption('test', string).text;
if (text.indexOf('ZZ') !== 0) {
g_form.setValue('main', 'other');
} else if (string.indexOf('91') !== 0) {
g_form.setValue('main', 'internal');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 06:08 PM