tag mapping from record procurer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2023 02:23 AM
how to map selected choice field value on record producer form that should be added as a tag in the attached record producer table, assume that record producer attached to incident table , now user selected one value from choice field then it should be add as a tag to the incident table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2023 03:57 AM
Hi,
You have to insert a record in label_entry table using script.
var tablename = 'incident';
var tag_sysid1 = '60515d501334f2409f507e776144b07c';
var tag_sysid2 = '98715d501334f5679f507e776144b111';
var tag_sysid3 = '12345d501334a677ff507e7761442345';
var le = new GlideRecord('label_entry');
le.initalize();
le.id_display = current.number;
le.id_type = tablename;
if(producer.variable_name =='choice1')
le.label = tag_sysid1;
if(producer.variable_name =='choice2')
le.label = tag_sysid2;
if(producer.variable_name =='choice3')
le.label = tag_sysid3;
le.notify_onchange = false;
le.read = 'yes';
le.table = 'incident';
le.table_key = current.sys_id;
le.title = tablename + ' - ' + current.number;
le.url = current.sys_class_name + '?sys_id=' + rec.sys_id + '&sysparm_view=';
le.insert();
You can use this script login in your record producer script.
Note: Please make required changes and correct typo mistakes if any.
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2023 04:12 AM
Hello @Sravan33 ,
To map a selected choice field value on a record producer form to a tag in the incident table, you need to do the following steps:
- Create a choice list variable on the record producer form with the desired options. You can use the Best Practices – Choice Lists article as a reference for creating and configuring choice lists.
- On the record producer form, right-click on the choice list variable and select Configure. In the Variable Attributes field, enter map_to_field=tags. This will map the variable value to the tags field in the incident table.
- Save the record producer form and test it by creating a new incident. You should see that the selected choice field value is added as a tag in the incident record.
You can also watch this video that shows how to map dropdown values on a record producer form using a lookup select box and a reference qualifier. This might be useful if you want to use dynamic values from another table instead of static values for your choice list.
I hope this answers your question.
Kind Regards,
Swarnadeep Nandy