- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2016 08:34 AM
Hello,
I want to create the change tasks creation via workflow (run script activity).
How to check if previous record has the completed state??
an example: I have an additional table which contains the information for the purpose of task creation, I have 3 columns ( Order, Short_description, Assignment Group).
I want to create the change tasks based on information from the table. The issue is, that the task should be created, if the previous task has the state = completed.
Does anyone know how to achieve it?
Thanks in advance for any answers!!!
BR
AS
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2016 09:07 AM
As I said if you are using run script activity to create a task. Use scratchpad variable as shown.
var task= new GlideRecord('sc_task');
task.initialize();
..
..
..
workflow.scratchpad.taskID=task.insert();
Now in your next activity before creating a task, check if the previous task is completed or not
var task= new GlideRecord('sc_task');
task.get(workflow.scratchpad.taskID);
if(task.state=='completed choice value'){
//insert task here
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2016 09:12 AM
Sure, let me know how it goes.