Copy record producer's full description to a custom field in HR case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2025 09:58 AM
Hi - We have a request to copy a record producer's full description as seen in the attachment to a custom field (ex. Full Description, u_full_description) every time an HR case is submitted. I'm thinking about writing a business rule where I'll assign this custom field to the record producer's full description as below but current.description is the case's description, not the record producer's full description. How do I get the value of the record producer's full description?
current.u_full_description = current.description;
- Labels:
-
Human Resources Service Delivery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2025 10:21 AM
You can do this instead using the Script field on the Record Producer:
var rpsysid = RP.getParameterValue('sysparm_id');
var catitem = new GlideRecord('sc_cat_item');
if (catitem.get(rpsysid)) {
current.u_full_description = catitem.description;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2025 10:29 AM
If the HR case was created by a record producer by verifying if current.template exists.
Business Rule (before insert):
if (current.template) {
var templateGR = new GlideRecord('sys_template');
if (templateGR.get(current.template)) {
current.u_full_description = templateGR.short_description; // Copy full description
}
}
Mark it helpful if this helps you to understand. Accept the solution if this gives you the answer you're looking for
Kind Regards,
Priyatam Patchipulusu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2025 10:39 AM
Thank you for the quick response, Brad. I did all this in the business rule and it also works.
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord("sc_cat_item_producer");
gr.addQuery("sys_id", 'cat_item sys_id');
gr.query();
if (gr.next()){
current.u_full_description = gr.getValue('description');
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2025 07:48 AM
Just want to follow up...A coworker of mine came up with a better solution using Workflow Studio. The action to update record is triggered whenever a new record is created in sn_hr_core_case and we can pick and choose which HR service the action applies to by setting the condition. This provides more flexibility than the original script, which hard codes a specific record producer with the sys_id. In addition, we want to avoid using custom fields whenever possible.
The script below is to append the full description of the record producer to the description of an HR case under "Catalog Item Full Description".
var descLabel = "<b>Catalog Item Full Description:</b>";
var originalDesc = fd_data.trigger.current.rich_description;
var rpFullDesc = fd_data.trigger.current.hr_service.producer.description; // Full description from the record producer
var modifiedDesc = originalDesc + descLabel + rpFullDesc;
return modifiedDesc;