scripts to check single line text against table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 07:52 PM - edited 02-14-2024 07:53 PM
I have created Single line text in service catalog, and I have table 'trusted domain whitelisting".
Details as per below
Single line Text variable (u_domain_name)
table name = u_trusted_domain_whitelisting
Table Column 1 = u_active (True/False)
Table Column 2 = u_domain_whitelisting
Here is scenario.
Scenario 1
When user enter a name in u_domain_name (variable), need to validate the domain name is existed or not in table "u_trusted_domain_whitelisting" and check if Table Column 1 = u_active (True) and it should check Table Column 2 = u_domain_whitelisting is existed if yes it need to show up an error message "Domain is available" and when user press "OK" it need to clear the u_domain_name (variable).
Scenario 2
When user enter a name in u_domain_name (variable), need to validate the domain name is existed or not in table "u_trusted_domain_whitelisting" and check if Table Column 1 = u_active (False) and it should skip check Table Column 2 = u_domain_whitelisting and nothing happen.
Please help me any one idea about this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2024 10:20 PM
@TMKAM using gliderecord in client script is not recommended ..But for testing purpose you can try that..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 12:22 AM
Dear Maddysunil,
I have managed to get the client scripts and script included working as expected.
client scripts
checkDomainwhitelist.prototype = Object.extendsObject(AbstractAjaxProcessor, {
validateDomain: function() {
var domainName = this.getParameter('sysparm_domain_name');
var domainGR = new GlideRecord('u_trusted_domain_whitelisting');
domainGR.addQuery('u_domain_whitelisting', domainName);
domainGR.query();
if (domainGR.next()) {
return 'true';
} else {
return 'false';
}
},
type: 'checkDomainwhitelist'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2024 12:29 AM