outputs not showing in action script

ServNowDev
Tera Guru

Here is the action script code, i have an email body as the input, it parse the data effectively and i want to output that data, but it keeps coming back empty when running test but works when running a background test script.

 

 

 

(function execute(inputs, outputs) {

    function htmlToStr(html) {
        var noHTML = html.replace(/<br(?:\s*)?\/?>/gi, "\n").replace(/(<([^>]+)>)/ig, '');
        return decodeURI(noHTML);
    }

    

  
var emailBody = htmlToStr(inputs.email.toString());

var keyValuePattern = /([a-zA-Z0-9_-]+)\s*:\s*([^\n]+)/g;
var keyValuePairs = {};
var match;

// Iterate through matches and populate the keyValuePairs object
while ((match = keyValuePattern.exec(emailBody)) !== null) {
    var key = match[1].trim();
    var value = match[2].trim();
    keyValuePairs[key] = value;
}

// Now you can use the keyValuePairs object to access the parsed data
gs.info("Parsed Key-Value Pairs:");
for (var key in keyValuePairs) {
    gs.info(key + ": " + keyValuePairs[key]);
}
  //outputs.email_var = keyValuePairs;
  
  outputs.country = keyValuePairs['country'];
 
  
 
  
})(inputs, outputs);

 

 

Thomas42_0-1691592845683.png

 

Thomas42_1-1691593804749.pngThomas42_2-1691593876558.png

 

0 REPLIES 0