We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

The value of the category field should appear in the short description field.

TanujB
Tera Contributor
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
var categoryValue = gForm.getValue('category');
    gForm.setValue('short_description', categoryValue);
}
I am using this code but this is not workable in client Scripting please help in this  
1 ACCEPTED SOLUTION

J Siva
Kilo Patron

Hi @TanujB 
It's g_form not gForm.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
var categoryValue = g_form.getValue('category');
    g_form.setValue('short_description', categoryValue);
}

Regards,
Siva

View solution in original post

4 REPLIES 4

J Siva
Kilo Patron

Hi @TanujB 
It's g_form not gForm.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
var categoryValue = g_form.getValue('category');
    g_form.setValue('short_description', categoryValue);
}

Regards,
Siva

GlideFather
Tera Patron

@TanujB 

 

it looks ok, try to clear the value in short description before you enter it there:

var categoryValue = gForm.getValue('category');
if (categoryValue) {
gForm.clearValue('short_description');
gForm.setValue('short_description', categoryValue);
}

 

_____
100 % GlideFather experience and 0 % generative AI

@TanujB oh and now I noticed..

what is gForm? shall it not be g_form? :)))

_____
100 % GlideFather experience and 0 % generative AI

Hi @TanujB I provided the same solution at the same time, could you please consider accepting as solution as well, please

_____
100 % GlideFather experience and 0 % generative AI