- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2022 07:20 AM
Hi All,
I am having a requirement where I need to set the due date of the catalog task when a field value changes in RITM.
Until that time due date should be empty
1. Create a request in service portal
2. Req, RITM, Sc_task are generated via a workflow associated with the catalog item
3.Once sc_task is generated I need to check a field value on RITM. If the field value is 'Approved' then only I should start the counter of sc_Task, until that time it should not start
Please guide me how to achieve this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2022 06:49 AM
Hello Srinivas K,
Please check with below script:
var scTask = new GlideRecord("sc_task");
scTask.addEncodedQuery("state=2"); //if state is work in progress
scTask.query();
if (scTask.next()) {
var startDate = new GlideDateTime();
var days = 2;
var hours = 9; // put the hours like 9 hours means 1 days. If you want you can put 24 hours for 1 day
var duration = new GlideDuration(60 * 60 * 1000 * hours * days);
var schedule = new GlideSchedule('your schedule sys_id'); //put your schedule sys_id here
var end = schedule.add(startDate, duration);
scTask.end_date=end;
scTask.update();
}
Please mark my respsone as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 06:06 AM
Hi Mahendra,
The custom field I am having is on RITM table only
As suggested I have added a wait for condition activity after the catalog task . The wait for condition contains if approval status (custom field) is approved, but even after the field value changes to approved, it is still in the same wait for condition activity, it is not moving out from that
Please guide what I am missing here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 08:17 AM
hello,
instead of using this in wait for condition activity copy the same script and paste it in the timer activity and try that should work.
Before that remove the wait the condition activity and replace it with timer activity and then paste the script and try .
Hope this helps
Mark the answer correct if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 09:54 AM
Hi,
In timer activity, there is only we can set duration but not any conditions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2022 06:49 AM
Hello Srinivas K,
Please check with below script:
var scTask = new GlideRecord("sc_task");
scTask.addEncodedQuery("state=2"); //if state is work in progress
scTask.query();
if (scTask.next()) {
var startDate = new GlideDateTime();
var days = 2;
var hours = 9; // put the hours like 9 hours means 1 days. If you want you can put 24 hours for 1 day
var duration = new GlideDuration(60 * 60 * 1000 * hours * days);
var schedule = new GlideSchedule('your schedule sys_id'); //put your schedule sys_id here
var end = schedule.add(startDate, duration);
scTask.end_date=end;
scTask.update();
}
Please mark my respsone as helpful/correct, if it answer your question.
Thanks