Alert message that pulls field values on form

jasonjones
Giga Contributor

Trying to create a catalog client script alert message that pulls information from populated fields as part of that alert message. Below are the field values in the record producer.

find_real_file.png

Below is the script.  The Alert fires, but doesn't pull the values from the form.

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
    var myAcknowledgement = g_form.getValue('acknowledgement');  
    var values = g_form.getValue('course_department' + 'course_number' + 'course section' + 'semester_term');
    if (myAcknowledgement == 'true')
        alert(values);
             
}

Any help is appreciated.

Thanks.
Jason

1 ACCEPTED SOLUTION

Vipin Murugesan
Kilo Sage

Hi,

your script is correct no issues in that, but g_form.getValue('course_department' + 'course_number' + 'course section' + 'semester_term');

can get values from one field at one time.

Instead create separate var and use those in alert.

for ex:

var  depart = g_form.getValue ('course_department');

var num = g_form.getvalue ('course_number');

alert ("Course Department "+depart+" Course Number "+num);

 

PS: Hit like, Helpful or Correct depending on the impact of the response

 

 

View solution in original post

4 REPLIES 4

Vipin Murugesan
Kilo Sage

Hi,

your script is correct no issues in that, but g_form.getValue('course_department' + 'course_number' + 'course section' + 'semester_term');

can get values from one field at one time.

Instead create separate var and use those in alert.

for ex:

var  depart = g_form.getValue ('course_department');

var num = g_form.getvalue ('course_number');

alert ("Course Department "+depart+" Course Number "+num);

 

PS: Hit like, Helpful or Correct depending on the impact of the response

 

 

ServiceNowSteve
Giga Guru
function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
    var myAcknowledgement = g_form.getValue('acknowledgement');  
    var val1 = g_form.getValue('course_department');
    var val2 = g_form.getValue('course_number);
    var val3 = g_form.getValue('course_selection');
    var val4 = g_form.getValue('semester_term');


    if (myAcknowledgement == 'true') 
    {
        alert(val1 + " " + val2 + " " + val3 + " " + val4);
    }
}

Found your reply when I had a similar problem and above worked perfectly, thanks for sharing. Your effort from years ago is saving my bacon today 😃

SanjivMeher
Kilo Patron
Kilo Patron

Use below script

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
    var myAcknowledgement = g_form.getValue('acknowledgement');  
    var values = g_form.getValue('course_department') +'-' +g_form.getValue('course_number')+ '-' +g_form.getValue('course section') +'-' + g_form.getValue('semester_term');
    if (myAcknowledgement == 'true') 
        alert(values);
             
}


Please mark this response as correct or helpful if it assisted you with your question.