- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 02:16 AM
Hi, Thanks for taking the time to read.
I have an issue where some workflows do not fill our the REQ requested for but will fill out the RITM requested for. There is more than one workflow so I was looking to create a business rule to catch all of this.
You can see below the request.requested_for is not populated.
I have tried to create a business rule to run after a record is inserted but I cannot get this to run. I think it might be to do with my triggers for when to run, which I set to run if the REQ Requested for is empty. I also tried to set it for everytime a certain item is created but this is not working either.
Below is the script and the trigger.
var grREQ = new GlideRecord('sc_request');
grREQ.get(current.sc_request);
grREQ.requested_for = current.requested_for;
grREQ.update();
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 07:14 PM
Hi,
Can you please try below:
var grREQ = new GlideRecord('sc_request');
grREQ.get(current.request.toString());
grREQ.requested_for = current.requested_for.toString();
grREQ.setWorkflow(false);
grREQ.update();
current.work_notes = 'test';
current.setWorkflow(false);
current.update();
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 02:22 AM
Hi,
Please create a after insert BR on sc_req_item table and use below script:
You had used grREQ.get(current.sc_request); it should be grREQ.get(current.request.toString());
var grREQ = new GlideRecord('sc_request');
grREQ.get(current.request.toString());
grREQ.requested_for = current.requested_for;
grREQ.update();
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 05:29 AM
HI,
Have you tried this?
In your script addQuery line was incorrect.
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 08:50 AM
Apologies for the delay, I have given this a go but this is also not working. The business rules is running as I did a test note for work notes, which appears. Something the script is stopping it from running.
var grREQ = new GlideRecord('sc_request');
grREQ.get(current.request.toString());
grREQ.requested_for = current.requested_for;
grREQ.update();
current.work_notes = 'test';
current.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2022 07:14 PM
Hi,
Can you please try below:
var grREQ = new GlideRecord('sc_request');
grREQ.get(current.request.toString());
grREQ.requested_for = current.requested_for.toString();
grREQ.setWorkflow(false);
grREQ.update();
current.work_notes = 'test';
current.setWorkflow(false);
current.update();
Thanks,
Anil Lande
Thanks
Anil Lande