- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 11:09 AM
Hi,
My requirement is that there is a catalog item with a string field called Tier 1 Name. It is a string field. What is needed is that when a user fills in the field, the system needs to check the cloud metadata table and see if the name already exists.
if it exists then a warning needs to come up and say that this entry already exists in the cloud metadata table. If not then the catalog item can be submitted.
is this possible to do with a string field and how would this be accomplished?
thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 11:54 AM - edited 03-11-2025 12:07 PM
Hello @snow_beginner,
You can try this code:
Catalog Client script
function onSubmit() {
var ga = new GlideAjax('CloudMetadataUtil');
ga.addParam('sysparm_name', 'exists');
ga.addParam('sysparm_tier_1_name', g_form.getValue("tier_1_name"));
ga.getXML(cloudExists);
function cloudExists(response) {
var cloudMetadataExists = response.responseXML.documentElement.getAttribute("answer");
if (cloudMetadataExists) {
g_form.addErrorMessage("Tier 1 Name: " + g_form.getValue('tier_1_name') + " already exists");
}
}
}
Script include:
var CloudMetadataUtil = Class.create();
CloudMetadataUtil.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
exists: function() {
var tier1Name = this.getParameter('sysparm_tier_1_name');
var cloudMetadataGR = new GlideRecord('cloud_metadata_table');
cloudMetadataGR.addQuery('tier_1_name', tier1Name);
cloudMetadataGR.query();
return cloudMetadataGR.next(tier1Name);
},
type: 'CloudMetadataUtil'
});
I hope it helps.
Have a good day 🙂
Beata
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 11:16 AM
Hello @snow_beginner
Yes this is possible, please create catalog client script. Use GlideAjax and Script Include, pass this variable values and check in the script include by gliding on the table if this exists or not.
If it exists, pass Yes, else pass No.
Additionally create another text field - where you store this value to show the users, or hide it, or utilise it in any other way you want.
Kindly mark my answer as helpful and accept solution if it helped you in anyway,
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNe
EISQCY

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 11:20 AM
You could create a client script onSubmit that will call a script include that will check if the name already exists. Script include should return true/false (exists/not exists). Then the client script should not permit to submit the form

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 11:54 AM - edited 03-11-2025 12:07 PM
Hello @snow_beginner,
You can try this code:
Catalog Client script
function onSubmit() {
var ga = new GlideAjax('CloudMetadataUtil');
ga.addParam('sysparm_name', 'exists');
ga.addParam('sysparm_tier_1_name', g_form.getValue("tier_1_name"));
ga.getXML(cloudExists);
function cloudExists(response) {
var cloudMetadataExists = response.responseXML.documentElement.getAttribute("answer");
if (cloudMetadataExists) {
g_form.addErrorMessage("Tier 1 Name: " + g_form.getValue('tier_1_name') + " already exists");
}
}
}
Script include:
var CloudMetadataUtil = Class.create();
CloudMetadataUtil.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
exists: function() {
var tier1Name = this.getParameter('sysparm_tier_1_name');
var cloudMetadataGR = new GlideRecord('cloud_metadata_table');
cloudMetadataGR.addQuery('tier_1_name', tier1Name);
cloudMetadataGR.query();
return cloudMetadataGR.next(tier1Name);
},
type: 'CloudMetadataUtil'
});
I hope it helps.
Have a good day 🙂
Beata
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 04:23 AM
thanks so much!