- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2020 07:27 PM
Hi All,
I need help to create a scheduled job to update state field on task table as per the Request state field on Sc_request table.
Suppose if the Request state on Request table is closed complete then update the State field on task to closed completed too.
Scheduled job is to check what all request are not updated correctly and update them.
For instance : we have few Requests records with "Request state" as closed complete but the state field on task table remain "Pending", those request records need to be updated
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2020 06:00 AM
1) Before Business Rule
2) Set the conditions as per your query i.e state = -5 and request state is completed in condition builder of business rule
3) Try the below script, update as per requirement.
var app=new GlideRecord('YOURTASKTABLENAME');
app.addQuery('number',current.number);
app.query();
if(app.next())
{
//Make use of setWorkflow false if required.
app.state = '3';
app.update();
}
}
Hope this helps!
Please Mark as ✅ Correct if this solves your issue and also mark (y) Helpful if it helps resolve your problem.
Thanks,
Saji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2020 12:11 AM
Hello Service MAnager,
You Can also write a business rule which will close the task when you are closing the request. As scheduled job runs on a specified time repeatedly.
Using busing rule ->whenever you are closing request all the tasks will also get closed.
Please keep posted if want code to implement the solution using business rule.
Please Mark it helpful/correct if my answer helps in any way to resolve your query.
Reach out to me if any more help required.
Regards
Yash.K.Agrawal