How to retrieve value from table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2023 07:25 AM
Hi All,
I have a variable "Party Tax ID" on form where user can enter a single value or multiple value.
Once entered I need to validate the value entered is present in the table at the backend or not.
Issue is we have some comma separated values at the backend in the table as attached,but when user enters any of those values in the form,mine script include validates only the first value.
How can we validate all the values.
Below are my script:
Script Include:
var getTax = Class.create();
getTax.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
getCampus: function () {
var taxid = this.getParameter('sysparm_u_party_tax_id');
var tax1 = new GlideRecord('customer_account');
tax1.addQuery('u_party_tax_id', taxid);
tax1.query();
if (tax1.next()) {
return tax1.u_party_tax_id;
}
},
isPublic:function(){return true;},
type: 'getTax'
});
Client Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var user_id = g_form.getValue('u_tax_id');
var ga = new GlideAjax('sn_customerservice.getTax');
ga.addParam('sysparm_name', 'getCampus');
ga.addParam('sysparm_u_party_tax_id',user_id);
ga.getXML(NameDetails);
function NameDetails(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
if(answer==user_id){
g_form.setValue("first_name",answer);
}
else{
g_form.clearValue('u_tax_id');
g_form.showFieldMsg('u_tax_id', 'Please enter Valid Tax ID','error',true);
}
}
}
Highlighted in yellow is Tax Id
Thanks,