Test workflow to run without need to create request item

Giri6
Tera Expert

I need to test the workflow.  I have hardcoded data in runscript to start. Is it possible to test workflow without having to create a catalog item and assign workflow and then create RITM? Appreciate it. If not any shortcuts to test workflow to minimize steps as much as possible.

11 REPLIES 11

Alok Das
Tera Guru
Well we don't have such functionality to run a workflow without attaching to any record. However for the quick testing you can attach it to any catalog item and order the item from portal.

Also, If you have only the run script activity in workflow and since you mentioned that you have hardcored the run script. Alternatively you can test the script im background scripts which would be more convenient way to test the script.... Please note that the current will not be working im background scripts since current picks up the current record object and its not present in background scripts execution.

SW7
Giga Guru

Giri,

 

Have you looked into Automated Test Framework yet? if not I would recommend taking a look.

 

Kind regards

Steve 

MrMuhammad
Giga Sage

You can use Workflow methods to associate workflow with existing RITM for testing. here is the sample code. 

var wf = new Workflow();
var context = wf.startFlow(<sys_id_of_workflow>, GlideRecord Object, 'record operation'); //record operation could 'insert' | 'update' etc.

 

Here you can read through the documentation. 

Workflow API

 

Please mark this ACCEPTED & HELPFUL if it helps. 

 

Thanks & Regards,

Sharjeel

Regards,
Muhammad