How to get the value of the sys choice instead of the label from a client script?

gavinteo
Kilo Contributor

Hi All,

I have this client script which is required to populate the comments field of the incident form based on a dropdown selection by the user.

However, i am unable to get the value as the system is retrieving the label of the sys_choice instead.

u_message is a field on my incident table which has a list of choices. The value of the sys_choice of the entry is "Testing 1234" and the label is "Testing".

The output of my script is getting "Testing" into the comments field instead of the "Testing 1234".

Tried looking around for solutions but can't seem to find any.

Below is an extract of my client script;

function onChange(control, oldValue, newValue, isLoading, isTemplate) {

  if (isLoading || newValue == '') {

  return;

  }

  g_form.setValue("comments",g_form.getDisplayBox("u_message").value);

  g_form.setValue("u_message","");

}

Thanks all in advance!

1 ACCEPTED SOLUTION
2 REPLIES 2

Thanks Kalai!