- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2020 06:33 AM
Hello,
I have a workflow on sc_request table that creates an sctask. It is a simple workflow:
Begin > Create Task > End
I want to store the value as a workflow scratchpad or a set value so that when the sc_task is closed, I can close a RITM being created through another workflow on the same REQ.
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2020 07:21 AM
Okay.
The WF will not know if the task is closed as WF is runnig on request table. So you nee dto update the request for the WF code to run.
May be you can do1 thing. Use the Br tht i gave when task is clsoed update the request work notes.
Then in your workflow add a wait for condition
// Set the variable 'answer' to true or false to indicate if the condition has been met or not.
var flag=0;
var gr = new GlideRecord("sc_task");
gr.addQuery("request",current.sys_id);
gr.query();
while(gr.next()) {
if(gr.state == 3) {
flag++;
}
}
if(flag == gr.getRowCount()) {
answer = true;
} else {
answer = false;
}
Then link the set values activity and make the request as closed.
The Wait for condition will run when the request is updated. And you update the request with the BR on sc_task table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2020 06:43 AM
before end add run script with below script
var gr = new GlideRecord("sc_task");
gr.addQuery("request", current.sys_id);
gr.query();
if (gr.next()) {
workflow.scratchpad.number = gr.number;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2020 07:00 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2020 07:13 AM
Hi
You can write a BR on sc_task
conditon
state changes to closed
var gr = new GlideRecord("sc_request");
gr.addQuery("request",current.request);
gr.query();
if(gr.next()) {
gr.state=3; //put right feild and values
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2020 07:15 AM