- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 03:58 AM - edited 06-07-2024 03:59 AM
I am having issue populating the description from HR Case to HR Task, I have a rich_description field on both HR case and HR Task and I am setting up some fields on HR Task via HR Template but it's not able to set the description from HR case in HR Task. Since rich_description field created on case level so {$parent.rich_description} not working as parent will be task table.
I have also tried in workflow script but that is also not working. Can someone help me who came across such issue?
Thanks,
Anmol
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 10:02 AM
Hi @Anmol12,
To populate the 'rich_description' from an HR Case to an HR Task in ServiceNow, you can use a combination of Business Rules, Script Includes, or Workflow Scripts. Since the '{$parent.rich_description}' is not working directly, you may need to manually script the population of the field.
Alternative Approach Using Workflow Script
If you are using a workflow, you can also achieve this with a workflow script:
1. Add a Script Activity to Your Workflow
- Open your HR Case workflow.
- Add a new `Script` activity to the workflow.
2. Configure the Script Activity
// Get the current HR Case and its HR Task
var hrTask = current; // Assuming this script runs in the context of an HR Task
var hrCase = new GlideRecord('sn_hr_core_case');
if (hrCase.get(hrTask.parent)) {
// Copy the rich_description from the HR Case to the HR Task
hrTask.rich_description = hrCase.rich_description;
hrTask.update(); // Save the HR Task record
}
This script assumes that it is being executed in the context of an HR Task within a workflow. It retrieves the parent HR Case and copies the 'rich_description' to the HR Task.
Thank you, please make helpful if you accept the solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 12:10 PM
@Anmol12 What do you mean by rich_description field is not present on task table ?
I am just doing dot walk to get parent record field value, in this case parent is holding HR Case record and rich_description exist there so it can fetch the value.
Have you tried to reproduce this on your personal instance ?
If you are doing it on your org instance then try to check any existing BR is not contradicting here ? Also try to lower your BR order to see if it executes or not, add some logs in BR .
Let me know if you have any further question for me.
Thanks,
Harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 02:40 PM
Hi Yashsvi,
I have run this script in my workflow run-script activity but it's not working.
Thanks,
Anmol
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 02:53 PM
Hi @Anmol12,
Sorry Anmol but please try this script once.
Script for Workflow Run Script Activity:-
(function execute(inputs, outputs) {
// Log starting message
gs.log("Starting script execution...");
// Query the associated HR Case record
var hrCase = new GlideRecord('sn_hr_core_case');
if (hrCase.get(inputs.task.parent)) {
// Log parent HR Case record found
gs.log("Parent HR Case found: " + hrCase.number.getDisplayValue());
// If HR Case record found, populate the description field in HR Task
outputs.task.description = hrCase.rich_description.getDisplayValue();
// Log description value
gs.log("Description value: " + outputs.task.description);
} else {
// Log parent HR Case record not found
gs.log("Parent HR Case not found.");
}
// Log completion message
gs.log("Script execution completed.");
})(inputs, outputs);
Thank you, please make helpful if you accept the solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 10:26 AM
@Anmol12 This is what i have tried and its copying the description ( HTML ) to HR task record description ( HTML).
Adding screenshot for your reference. Hope it will help you.
Thanks,
Harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 02:37 PM
Hi Harsh,
I have tried it but It's not working as parent is task table and rich_description field is not present on task table, it's on sn_hr_core_case.
Thanks,
Anmol

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 12:10 PM
@Anmol12 What do you mean by rich_description field is not present on task table ?
I am just doing dot walk to get parent record field value, in this case parent is holding HR Case record and rich_description exist there so it can fetch the value.
Have you tried to reproduce this on your personal instance ?
If you are doing it on your org instance then try to check any existing BR is not contradicting here ? Also try to lower your BR order to see if it executes or not, add some logs in BR .
Let me know if you have any further question for me.
Thanks,
Harsh