getValue Not Returning Anything in onSubmit Script

Bradford Shelle
Kilo Guru

I'm running through an onSubmit() Catalog Client Script trying to get it to work.

When I run a getValue on a field during an onChange() script, I can see the value of the field I'm looking at no problem. As soon as it's an onSubmit() script though, I don't get a value returned to me.

function onSubmit() {

  //Type appropriate comment here, and begin script below

  var client = g_form.getReference('u_client', getClientEmail);

}

function getClientEmail(client) {

  if (client.email != g_form.getValue('u_client_email')) {

  var email = g_form.getValue('u_client_email');

  alert("Email is: " + email + " and Client is: " + client.sys_id);

  var ga = new GlideAjax('clientEmail');

  ga.addParam('sysparm_name', 'getClientEmail');

  ga.addParam('sysparm_client', client.sys_id);

  ga.addParam('sysparm_email', email);

  ga.getXMLwait();

  }

}

You can see on lines 8 and 9 I'm doing a getValue, and on line 10 I'm just doing a sanity check to make sure that the different parameters I'm passing through to a Script Include actually work.

I've tried poking around to see if there was some conflict with doing a getValue on an onSubmit catalog client script, but nothing was jumping out at me. Does anyone have any ideas?

1 ACCEPTED SOLUTION

You should probably just do it right in the Script of the record producer itself and not as a Client Script.   Are you only wanting to update that record, or are you actually creating another record?   You can use a Record Producer to update records instead and just cancel the "normal" creation of the record.


View solution in original post

11 REPLIES 11

Hey, you are welcome and we've all been there.


Hi, I'm having a similar issue. How did you end up doing this in the record producer script?