Auto populate short Description of Request with short description variable of requested item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2022 05:31 AM
Hello , I have made a requested item with a var short description. I want when a user writes something in short description and press submit, automatically this short description to populate request's short description. I tried this BR on table requested_itemand works ok, BUT it disappears the requested item.
(function executeRule(current, previous /*null when async*/) {
var req = current.request.getRefRecord();
req.short_description = current.short_description;
req.update();
})(current, previous);
as you can see, its empty. normally it should have the requested item. But as long as BR is active, it doesn't show it to me. When BR is not active, Requested item appears normaly.
thank u!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2022 05:52 AM - edited ‎11-15-2022 05:53 AM
Try below:
var req = new GlideRecord('sc_request');
req.addQuery('sys_id',current.request);
req.query();
if(req.next())
{
req.short_description = current.variables.short_description;
req.update();
}
This BR should be on RITM table.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2022 06:15 AM
it doesn't work for me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2022 06:58 AM - edited ‎11-15-2022 07:00 AM
Hi Vasilis,
Hi Vasilis,
It worked for me . Please update your scripts with WHEN TO RUN : After & Insert and Update
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('sc_request');
gr.addQuery('sys_id',current.request);
gr.query();
while(gr.next()){
gr.short_description = current.variables.short_description;
gs.log('Short:' +current.variables.short_description);
gs.log('Short1:' +gr.short_description);
gr.update();
}
})(current, previous);
Screenshot:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2022 07:11 AM
@Vasilis can you share the screenshot of your BR.
Raghav
MVP 2023