Copy Category and Subcategory to REQ form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
I need some advice on the best way to do this. Requirements are to add Category and Subcategory fields to the REQ or table. The reason is for reporting purposes. One REQ could have multiple tasks causing a skew in the metrics. We want to report on these two fields from the REQ table instead.
I’ve added a category and subcategory field to the task table. The dropdown choices are being dot-walked from the INC table just so everything matches up. Once I add these two fields to the REQ table, I need a trigger for them to populate from the task table when the ticket is set to closed status. What would be the ideal way of copying these two fields? Would it be a business rule with a script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @Menalik
customizing REQ layout or table is not recommended by servicenow, it is just like a shopping cart , but if you really need the customization for your reporting purpose, a after update business rule is most effective in this case for copying your field…
(function executeRule(current, previous /*null when async*/) {
var parentReq = new GlideRecord('sc_request');
// NOTE: If your BR is on the sc_req_item table, use current.request
// If your BR is on the sc_task table, use current.request_item.request
var reqSysId = current.request_item.request;
if (parentReq.get(reqSysId)) {
// Replace 'u_category' and 'u_subcategory' with your exact custom field names
parentReq.u_category = current.u_category;
parentReq.u_subcategory = current.u_subcategory;
parentReq.update();
}
})(current, previous);
if this will help you please close this chat by marking my answer as Accepted Solution and Helpful. It will help other members to find their answers to similar problems.
Regards,
Deepak Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Thank you for this recommendation, Deepak! Would it be better to add these two fields to the RITM instead? If so, would I replace the 'req' with 'ritm' in the above code?

