Copy RITM Variable to Task short description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 07:21 AM
Hi All,
Im trying to create a solution where task's short description copies the value of a variable passed in the RITM.
what is the best way of solving this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 07:44 AM
Hi @dev_K
You can write business rule on sc_task table (before -insert)
(function executeRule(current, previous /*null when async*/) {
var ritm = new GlideRecord('sc_req_item');
if (ritm.get(current.request_item)) {
var variableValue = ritm.variables.your_variable_name;
current.description = variableValue;
}
})(current, previous);
Thanks and Regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2024 07:45 AM
If you are using a workflow to create the Catalog Task, in the Advanced script, use a line like this:
task.description = current.variables.var_name;
You could also do something similar with a Business Rule on the sc_task table before insert with Filter Conditions for the Catalog Item and Short Description to narrow it down to this task. The script on the BR would look like this:
(function executeRule(current, previous /*null when async*/) {
current.description = current.variables.var_name;
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 01:00 AM
Before insert BR on Ctask table
(function executeRule(current, previous /*null when async*/) {
if (current.request_item) {
var ritmId = current.request_item.sys_id;
var grRitm = new GlideRecord('sc_req_item');
if (grRitm.get(ritmId)) {
current.short_description =grRitm.variables.variableName;
}
}
})(current, previous);