
- 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 03:32 AM
Hi Rakesh,
If this content solved your issue/answered the question then please "Accept Solution" so that the question will be moved out from the unanswered list.
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
11-22-2022 07:42 AM
hi SaiKiran,
i have referred same code, getting error message

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2022 07:44 AM
year and Minor/major
should be dispalyed in Release version.
if select release as minor then minor release should be capture .
or
iif select release as Major then minor release should be capture in release version.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2021 10:33 PM
Hi Rakesh,
Create Multiple Client script for each Fields Data Changes.
Example:- You have 3 Fields and Need to add all 3 Strings in a single field while any one of out of 3 fields changes.
I Have a field called "Name" and three fields value needs to be added "Name" field
A). First Name
B). Middle Name
C). Last Name
Name = "First Name" + "Middle Name" + "Last Name"
So IN this condition I have 3 OnChange Client script on each field changes (First Name, Middle Name, Last Name). So any one of the fields will be changed, NAME field will be auto concatenated.
********************************************************************
OnChange Client Scrip_1
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var firstname = g_form.getDisplayValue('u_first_name');
var middlename = g_form.getDisplayValue('u_middle_name');
var lastname = g_form.getDisplayValue('u_last_name');
g_form.setValue('u_name', firstname + ' ' + middlename + ' ' + lastname);
}
Note:- Similar you have to write 2 more Client scripts for other field changes.
Regards,
Pankaj