Trying to access variable value from workflow to script include

ak48
Tera Contributor

Hi,

I have a script include and there is a value stored in the variable and I have to access that value from workflow run script then how can I access that value? Please help me on this 

Thanks

1 ACCEPTED SOLUTION

Try this

var myScript = {  //myScript - script include name
  getValue: function() {
var abc = gef[1];
    return abc;
  }
};

// In your workflow script
var myIncludedScript = gs.include('myScript');
var value = myIncludedScript.getValue();
gs.info(value); 

View solution in original post

10 REPLIES 10

@ak48 

//In the script include define function as below
functionName : function (){
var abc = gef[1]; //variable
return abc;

};

 

//In workflow run script, pass the script include name along with function name

var def = new script_include_name().functionName();

Basheer
Mega Sage

Hi @ak48 ,

You want the variable present in Script include to be passed to workflow?

 

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

ak48
Tera Contributor

Yes I want to pass value from script include to workflow run script 

You can pass the values as input to the workflow, you might be triggering the workflow from script include, there you need to pass. Something like this

var wf = new global.Workflow();  
var   wfId = wf.getWorkflowFromName("workflowName");  
var temp={};  
temp.input1="input1";  
temp.input2="input2";  
var context = wf.startFlow(wfId, null,null,temp);  
Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

Namrata Ghorpad
Mega Sage
Mega Sage