- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 03:20 AM
Hi All,
I've created a script that is run via the workflow to set the Request short_description to what has been entered in the summary variable.
I'd like to now copy what is in the Request short_description to the Requested Item short_description (done this way so I don't have to customise both scripts for different catalog items.
This is what I currently have which works to update the request - how can I change it to work to update the request item from what is on the request?
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 10:30 AM
Hi Cat,
In a workflow that's running on the sc_req_item table, 'current' refers to the Requested Item record, so you just need one line to set the value of current.short_description to the same thing you're setting gr.short_description to:
var desc = current.cat_item.name;
var num = current.number;
var gr = new GlideRecord('sc_request');
if (gr.get(current.request)){
gr.short_description = current.variables.summary;
gr.requested_for = current.variables.request_for;
current.requested_for = current.variables.request_for;
gr.update();
current.short_description = current.variables.summary;
}
Or if you really want to set it to the value from the request field,
var desc = current.cat_item.name;
var num = current.number;
var gr = new GlideRecord('sc_request');
if (gr.get(current.request)){
gr.short_description = current.variables.summary;
gr.requested_for = current.variables.request_for;
current.requested_for = current.variables.request_for;
gr.update();
current.short_description = current.request.short_description;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2024 10:30 AM
Hi Cat,
In a workflow that's running on the sc_req_item table, 'current' refers to the Requested Item record, so you just need one line to set the value of current.short_description to the same thing you're setting gr.short_description to:
var desc = current.cat_item.name;
var num = current.number;
var gr = new GlideRecord('sc_request');
if (gr.get(current.request)){
gr.short_description = current.variables.summary;
gr.requested_for = current.variables.request_for;
current.requested_for = current.variables.request_for;
gr.update();
current.short_description = current.variables.summary;
}
Or if you really want to set it to the value from the request field,
var desc = current.cat_item.name;
var num = current.number;
var gr = new GlideRecord('sc_request');
if (gr.get(current.request)){
gr.short_description = current.variables.summary;
gr.requested_for = current.variables.request_for;
current.requested_for = current.variables.request_for;
gr.update();
current.short_description = current.request.short_description;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2024 11:52 AM
Thank you! This was what I was needing!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 07:28 AM