Flow Designer : Inbound Email not getting the correct location

sailor_moon
Tera Contributor

Hi All,

I'm creating a flow designer and the trigger is inbound email.

My problem is I'm not getting the correct location. I created an action so that I can use it for look up records of Location. As you can see I set the Site that will serve as the location.

 

Please help me to resolve this as I was stuck 😞

Please see the screenshot below

 

Email Sample:

Site: 123 Site Location

 

Result that I get:

Location: 465 Site Location

 

sailor_moon_0-1708489636481.png

sailor_moon_1-1708489646514.png

sailor_moon_2-1708489661655.png

 

Action

sailor_moon_3-1708489722638.png

sailor_moon_4-1708489732128.png

 

sailor_moon_5-1708489740608.png

sailor_moon_6-1708489756488.png

 

 

1 ACCEPTED SOLUTION
3 REPLIES 3

Amit Pandey
Kilo Sage

Hi @sailor_moon 

 

Can you try the following email parsing logic-

 

(function execute(inputs, outputs) {
    var emailBody = inputs.emailBody; // Assuming you have an input variable emailBody which contains the body of the email


    var locationPattern = /Site:\s*(.+)/i;
    var locationMatch = emailBody.match(locationPattern);

    if (locationMatch && locationMatch.length > 1) {
        var location = locationMatch[1].trim(); 
        outputs.location = location; 
    } else {
        outputs.error = "Location not found in email."; // If location information is not found, set an error message
    }
})(inputs, outputs);

Please mark my answer helpful and correct.

 

Regards,

Amit

Hi @Amit,

 

I'm still getting the incorrect location 😞

sailor_moon_0-1708495452522.png

sailor_moon_1-1708495531195.png

This is the sample email that I created while this is the incident created

sailor_moon_2-1708495601728.png