Copy From One Field To Another Field

AliGeeJay
Kilo Explorer

I am trying to find out how to copy data from one field to another field if the first field contains data.

For example if "current.caller_id.u_location.u_location_information" contains data then I need it to be copied into "current.caller_id.location.u_location_information".

The field "current.caller_id.u_location.u_location_information" is on one set and the field "current.caller_id.location.u_location_information" is on another set.

Ultimately this will linked into a UI Action button but I am having issues trying to work out the script.

Trawling through the Wiki and the Forums has not given me any ideas... or I cannot see the answer after looking for so long.

Any help will be gratefully received.

1 REPLY 1

ssears
Kilo Expert

Are you looking for something like this? I used it to populate location to the incident table by referencing the caller_id in a client script...

Type = onChange
Field name = Contact(caller_id)

function onChange(control, oldValue, newValue, isLoading) {
if (newValue == ''){
return; // no value to get, nothing to do
}
var callerid = g_form.getReference('caller_id');
if (!callerid){
return; // could not find the user... should not happen but you never know
}
g_form.setValue('u_location',callerid.location);
}