
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2018 02:06 AM
Hi All,
I want to concatenate two variables , those are select box variable types having with --None--field and mandatory too. When i selecting any of those variables i want to populate the values into another field.
How to do that?? If anyone knows give me suggestions
i'm using onchange script but it applies for only one field.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var abc= g_form.getDisplayValue('x');
var xyz= g_form.getDisplayValue('y');
g_form.setValue('fieldvalue', abc+ ' ' + xyz+);
Regards,
Rakesh
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2018 02:45 AM
Hi Rakesh,
Create 2 onChange client scripts using this script. One for X one for Y:-
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var abc= g_form.getDisplayValue('x');
var xyz= g_form.getDisplayValue('y');
g_form.setDisplayValue('targetfieldname', abc+ ' ' + xyz);
}
This should work, if not post more details to get it solved.
Thanks,
Saikiran Guduri (NOW)
Associate Certificate Engineer | ServiceNow Store Apps
(Please mark the answer as correct answer/helpful/accept the solution if it helps)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2018 02:09 AM
Hi Rakesh,
As per your requirement you should create 2 client scripts (Same script in both). One on variable x, other on y.
Thanks,
Saikiran Guduri (NOW)
(Please mark the answer as correct answer/helpful/accept the solution if it helps)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2018 02:38 AM
But only one value is storing another value is not getting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2018 02:42 AM
Can you try below code:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var abc= g_form.getValue('x');
var xyz= g_form.getValue('y');
var pqr = abc + ' ' + xyz;
g_form.setValue('fieldvalue', pqr);
Thanks
Shashikant
Hit Helpful or Correct on the impact of response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2018 02:45 AM
Hi Rakesh,
Create 2 onChange client scripts using this script. One for X one for Y:-
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var abc= g_form.getDisplayValue('x');
var xyz= g_form.getDisplayValue('y');
g_form.setDisplayValue('targetfieldname', abc+ ' ' + xyz);
}
This should work, if not post more details to get it solved.
Thanks,
Saikiran Guduri (NOW)
Associate Certificate Engineer | ServiceNow Store Apps
(Please mark the answer as correct answer/helpful/accept the solution if it helps)