- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 07:33 AM
Hi. I'm trying to create a new entry in a custom table from the value in a catalog item.
My table name is 'u_cmdb_ci_whitelisted_url' the field name I want to populate on the is 'name'
The field in my variables is called 'external_party_organisation_url'
Can someone advise if my script is correct please? (spoiler - it's not working currently!)
Solved! Go to Solution.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 07:51 AM - edited 09-13-2024 07:52 AM
You need to use your server for calling function. The server variable holds the GlideRecord for your custom table u_cmdb_ci_whitelisted_url. please refer below.
(function() {
var server = new GlideRecord('u_cmdb_ci_whitelisted_url'); // Use 'server' as the variable name
server.initialize(); // Initialize the new record
server.name = current.variables.external_party_organisation_url; // Set the 'name' field with the variable value
server.insert(); // Insert the new record into the table
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 07:51 AM - edited 09-13-2024 07:52 AM
You need to use your server for calling function. The server variable holds the GlideRecord for your custom table u_cmdb_ci_whitelisted_url. please refer below.
(function() {
var server = new GlideRecord('u_cmdb_ci_whitelisted_url'); // Use 'server' as the variable name
server.initialize(); // Initialize the new record
server.name = current.variables.external_party_organisation_url; // Set the 'name' field with the variable value
server.insert(); // Insert the new record into the table
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 08:25 AM
Fantastic! That works. Thank you. I didn't know that about 'server'. Is that because it's a custom table?