In a Action in Flow Designer, how to pass inputs to output variables which has the structure?

vishaljaiswal
Giga Expert

Scenario: As per the business requirement, i am representing a scenario. I have 2 inputs from Action as below, how can i pass these inputs value to output variables Name and Email. PFA for output structure.

 

Inputs:

var name = inputs.incident.caller.name;
var email = inputs.incident.caller.email;
 
vishaljaiswal_0-1706106172385.pngvishaljaiswal_1-1706106190634.png

 

 

@Ankur Bawiskar or anyone please help if possible.

1 ACCEPTED SOLUTION

vishaljaiswal
Giga Expert

I tried a lot and got the solution. below is the script.

(function execute(inputs, outputs) {
// ... code ..

var number = inputs.incident.number;
var name = inputs.incident.caller_id.name;
var email = inputs.incident.caller_id.email;

var test = {
    'Number':number,
    'Callers':{
        'results':[{
            'Name':number,
            'Email':email
            }]
    }
}

outputs.parent_field = test;

})(inputs, outputs);

View solution in original post

1 REPLY 1

vishaljaiswal
Giga Expert

I tried a lot and got the solution. below is the script.

(function execute(inputs, outputs) {
// ... code ..

var number = inputs.incident.number;
var name = inputs.incident.caller_id.name;
var email = inputs.incident.caller_id.email;

var test = {
    'Number':number,
    'Callers':{
        'results':[{
            'Name':number,
            'Email':email
            }]
    }
}

outputs.parent_field = test;

})(inputs, outputs);