
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2017 09:00 AM
I would like to automatically add a tag to an incident when a state is changed and a user is prompted. Here is my client script code:
var lab = new GlideRecord('label_entry');
lab.initialize();
lab.title = 'Incident - ' + g_form.getValue('number');
lab.label = '6120c3ed4f383600847c2f9ca310tr45e'; // defined label KB REFERENCED
lab.url = 'incident.do?sys_id=' + g_form.getUniqueValue() + '&sysparm_view=';
lab.id_display = g_form.getValue('number');
lab.id_type = 'incident';
lab.table = (g_form.getTableName());
lab.table_key = (g_form.getUniqueValue());
lab.insert();
The label entry is inserted but the table and table_key fields are absent. I also notice a message in the error log:
Table name cannot be null: java.lang.IllegalStateException: Table name cannot be null: com.glide.db.TableDescriptor.<init>
The tag does not show up on the incident. I must be doing something wrong with how the table is getting passed. Any thoughts?
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2017 12:43 PM
I had to do this through an Ajax call /script include and it was able to work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2017 12:43 PM
I had to do this through an Ajax call /script include and it was able to work.