
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 12:41 PM
Below is an onChange Client Script I wrote to populate two of my reference fields. However, when the script runs it is setting the values to the variable name used within the script, see screen shot below. How can I get it to populate with the display values?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
var subtype = g_form.getValue('submission_type');
var audience = g_form.getValue('audience');
var valueArrayR = new Array("127264040fca7a00d9db6ab8b1050e11");
var labelArrayR = new Array("SLA Requirement Update");
var valueArrayD = new Array("09efe46e0f776200e557abf8b1050eb0");
var labelArrayD = new Array("Enterprise Reporting");
if ( audience == 'Other' & subtype == 'SLA Requirement Update') {
g_form.setValue('request', 'valueArrayR','labelArrayR');
g_form.setValue('department_cu', 'valueArrayD','labelArrayD');
}}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 12:44 PM
Hi Edwin!
I assume the valueArrayR and valueArrayD variables contain the required sysids?
Please change the lines inside if condition to the following:
g_form.setValue('request', valueArrayR);
g_form.setValue('department_cu', valueArrayD);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 12:44 PM
Hi Edwin!
I assume the valueArrayR and valueArrayD variables contain the required sysids?
Please change the lines inside if condition to the following:
g_form.setValue('request', valueArrayR);
g_form.setValue('department_cu', valueArrayD);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 12:47 PM
The above code I gave will set the values and the actual display value on the table shows up. You could even use it the way you intended.
g_form.setValue('request', valueArrayR,labelArrayR);
g_form.setValue('department_cu', valueArrayD,labelArrayD);
Except, you need to lose the quotes since quotes make them processed as strings instead of variables.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 12:52 PM
Thank for your reply, both way worked for me so I went with the first update you gave. Thanks for your help