Need help calling a subflow (flow designer) from a legacy workflow

JLeong
Mega Sage

Hi Guys,

I am trying to call a subflow from a legacy workflow and I can't make it to work.

  1. I published the subflow and then copy code snippet
  2. In the workflow, I have a Run Script and pasted the code snippet
  3. I updated the input
  4. Run the workflow but the subflow is not triggered


    Maybe I am missing something, could someone please help!

    Thank you!


    (function() {

     

    try {
    var inputs = {};
    inputs['si'] = '4e6ae8ea1be9a91064adff39cc4bcb95';  // GlideRecord of table: sc_req_item

     

    //Start Asynchronously: Uncomment to run in background.Code snippet will not have access to outputs.
    //sn_fd.FlowAPI.getRunner().subflow('global.oimnetworkgenericid').inBackground().withInputs(inputs).run();

    //Execute Synchronously: Run in foreground. Code snippet has access to outputs.
    var result = sn_fd.FlowAPI.getRunner().subflow('global.oimnetworkgenericid').inForeground().withInputs(inputs).run();
    var outputs = result.getOutputs();

     

    // Current subflow has no outputs defined.
    } catch (ex) {
    var message = ex.getMessage();
    gs.error(message);
    }

    })();

1 ACCEPTED SOLUTION

Hi Michael,

 

Sorry for the delay... 

You need to do a GlideRecord query:

 
var inputs = {};
var reqID = current.sys_id; // get the sysID of the SI
var si= new GlideRecord('sc_req_item');
si.get(reqID ); // get the reference of the item request
i
nputs['si'] = si;  
.
.
.
.
 
Hope this helps.
 
Regards,
 
 

View solution in original post

2 REPLIES 2

Community Alums
Not applicable

JLeong, 

 

Did you ever figure out a solution?  I'm having the same problem now.

 

 

Hi Michael,

 

Sorry for the delay... 

You need to do a GlideRecord query:

 
var inputs = {};
var reqID = current.sys_id; // get the sysID of the SI
var si= new GlideRecord('sc_req_item');
si.get(reqID ); // get the reference of the item request
i
nputs['si'] = si;  
.
.
.
.
 
Hope this helps.
 
Regards,