- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 10:15 AM
Hello everyone!
I need to validate the lenght of this "IBAN code" field (Thisi is a Record Producer):
Based on this field in another table:
A little explanation: I need to validate IBAN codes, but the IBAN are different for each country. So I need the validation depends on the country I select.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 10:41 AM
@Facundo Prado In order to implement this functionality, you need to implement the following.
1. Create a Script Include: Create a client callable script include as follows.
Here is the script include code.
var MyUtilsV2 = Class.create();
MyUtilsV2.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize: function() {},
getIBANFormat:function(){
var glideRecord = new GlideRecord('cmn_location');//Replace table with your table name
glideRecord.addQuery('country',gs.getUser().country);
glideRecord.query();
var iBAN= '';
if(glideRecord.next()){
iBAN=glideRecord.getValue('ibancodes'); //replace name with your IBAN format column name
}
return iBAN;
},
type: 'MyUtilsV2'
});
2. Create an onChange Client script on iBAN filed on your record producer.
Here is the code.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('HelloWorld');
ga.addParam('sysparm_name', 'getIBANFormat');
ga.getXML(getIBANFormatResponse);
function getIBANFormatResponse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
var ibanFieldValue = g_form.getValue('iban_code');
if(answer.test(ibanFieldValue)){
alert('iban is correct');
}
else{
alert('invalid data');
}
}
}
Please make the appropriate changes in the script to match with your existing implementation.
Hope this helps,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 10:26 AM
@Facundo Prado Only length of IBAN code should match or it should be exactly same as in the another table ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 10:28 AM - edited 10-10-2023 10:29 AM
It should be exactly the same "length" as in the table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 10:41 AM
@Facundo Prado In order to implement this functionality, you need to implement the following.
1. Create a Script Include: Create a client callable script include as follows.
Here is the script include code.
var MyUtilsV2 = Class.create();
MyUtilsV2.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize: function() {},
getIBANFormat:function(){
var glideRecord = new GlideRecord('cmn_location');//Replace table with your table name
glideRecord.addQuery('country',gs.getUser().country);
glideRecord.query();
var iBAN= '';
if(glideRecord.next()){
iBAN=glideRecord.getValue('ibancodes'); //replace name with your IBAN format column name
}
return iBAN;
},
type: 'MyUtilsV2'
});
2. Create an onChange Client script on iBAN filed on your record producer.
Here is the code.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('HelloWorld');
ga.addParam('sysparm_name', 'getIBANFormat');
ga.getXML(getIBANFormatResponse);
function getIBANFormatResponse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
var ibanFieldValue = g_form.getValue('iban_code');
if(answer.test(ibanFieldValue)){
alert('iban is correct');
}
else{
alert('invalid data');
}
}
}
Please make the appropriate changes in the script to match with your existing implementation.
Hope this helps,