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

You can use below script to generate Request. Change the Catalog item sys_id ,variable name and variable values.

var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem('e46305bdc0a8010a00645e608031eb0f'); 
cart.setVariable(item,'os','Linux Red Hat');
var rc = cart.placeOrder(); 
gs.addInfoMessage(rc.number);

 

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");