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.

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
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
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);
}

 

_____
This reply is 100 % GlideFather and 0 % AI

@TanujB oh and now I noticed..

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

_____
This reply is 100 % GlideFather and 0 % AI

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

_____
This reply is 100 % GlideFather and 0 % AI