The CreatorCon Call for Content is officially open! Get started here.

Change Task creation via workflow script

Arthur7
Tera Contributor

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

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

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


}


View solution in original post

15 REPLIES 15

Abhinay Erra
Giga Sage

Sure, let me know how it goes.