Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

concatenating two columns into one

Don11
Mega Expert

Hello,

We have created a database view and was wondering if it's possible to concatenate two columns using a script (see below).

If so can this script can also be applied to a report or automated indicator?

  • var now_GR = new GlideRecord('u_chg_cab_definition_view');

 

find_real_file.png

1 ACCEPTED SOLUTION

Hi,

you can make that field as calculated and store the concatenated value

Use advanced view

Something like this; you can use current object and dot walk to whichever field you wish

(function calculatedFieldValue(current) {

	// Add your code here
	return current.u_cab_meeting + ' ' + current.cab_definition; 

})(current);

find_real_file.png

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

8 REPLIES 8

Don11
Mega Expert

Thank you both for your input.

Any idea how I would update the dictionary record for "CAB definition" to concatenate a dot walk within "CAB meeting"? i.e. u_cab_meeting.cab_definition.

 

 

Hi,

you can make that field as calculated and store the concatenated value

Use advanced view

Something like this; you can use current object and dot walk to whichever field you wish

(function calculatedFieldValue(current) {

	// Add your code here
	return current.u_cab_meeting + ' ' + current.cab_definition; 

})(current);

find_real_file.png

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Don11
Mega Expert

One last question, what if I just wanted to merge the 2 columns below into a new column, what process would be best?

Is it possible to use a metric instance too hold the merged data?

 

find_real_file.png

since you will already have custom field which concatenates both; add that to database view

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader