Populate custom field from sc_cat_item to sc_req_item
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2024 05:34 PM
I have created a custom reference field on the catalog item table, say u_customfield1, and I want that to be populated on u_customefield2 on the sc_req_item form when a new RITM is created from that catalog item. I do not want to make it a variable as this would require updating over 1000 catalog items.
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2024 06:39 PM - edited ‎03-31-2024 06:39 PM
Hi @Richard Tyler you can create a after insert BR on RITM table with below script
var ritm = new GlideRecord('sc_cat_item');
ritm.addQuery('name',current.cat_item.name); // match catalog name with item name field on ritm table
ritm.query();
if(ritm.next())
{
current.fieldname = ritm.fieldname.toString(); // map the field value on ritm table
current.update();
}
Regards
Harish
Harish