Parent & child workflow issue

SNOW User8
Giga Guru

Hi All,

I would like to get few solutions for my problem related to parent & child workflow.

I have created a custom table which extends 'sc_request' table & record producer form.

Once the user submits the form it will create entry in that custom table & it will attach to the workflow which I have created for that table.

In that workflow I have attached another workflow (sub workflow) which will create Requested Item. 

The problem here is, my attached workflow is not creating the RITM. But it seems its alone working fine. When I include that workflow in my custom table workflow it's not working (not creating RITM).

My custom table is an extended table of sc_request & it has 'Requested Item' Related List. 

What is the problem here? What should I do?

Please suggest/help me.

 

Regards,

SNOW

1 ACCEPTED SOLUTION

SNOW User8
Giga Guru

I handled it by adding the following lines in Run Script 

var catItemId = "SYSID"; //sys_id of an item needs to be created as a new RITM
var requestId = current.sys_id;
var helper = new GlideappCalculationHelper();
helper.addItemToExistingRequest(requestId, catItemId, "1");

 

 

View solution in original post

6 REPLIES 6

Deepak Kumar5
Kilo Sage

You can create your RITM using Run script and then your workflow will auto-attached with created RITM.

Hi,

Thanks for your time.

Yes it is working. But it's created new RITM without any workflow. I want my workflow to be attached with that RITM. 

Please suggest me.

Deepak Kumar5
Kilo Sage

1) Add Workflow in your Catalog item configuration.

2) Add run script in your custom table workflow to submit above Item.

  Refer - https://community.servicenow.com/community?id=community_question&sys_id=73ce7ea5db58dbc01dcaf3231f9619b8

Hi 

Thanks again

1). Added workflow in my Catalog item configuration

But I don't know how to submit the above item in a script

I have included the below code, but its only creating new RITM without the workflow. 

var ritm = new GlideRecord('sc_req_item');
ritm.initialize();
ritm.request = current.sys_id;
ritm.cat_item = "SYS_ID";
ritm.insert();