Parsing values from email via Flow Desginer

Joel O
Mega Sage

Hello there, 

 

At this time, I am currently and successfully able to parse out name value pairs from inbound emails by way of the Parse Email Flow Action . Also, I am able to successfully apply those values to an existing catalog item on text fields, however I am experiencing a situation where I'd like some assistance. 

 

Currently our inbound email comes in as such:

  • Employee: Doe, John
  • Employee Number: 123456
  • Status: Active
  • Effective Date: 11/4/2024
  • Supervisor: Doe, Jane

However, what I would like to do is convert the Employee and Supervisor field data format from "Doe, John" (lastname, firstname) to "John Doe" (firstname lastname). 

 

Is there a possible way to script this or use the Transform Function options to change the format? Looking for guidance for this little item, but all other aspects of this Parse Email Action for now works well (just need to work on getting it added to the Reference field 😉)

 

Thank you.

1 ACCEPTED SOLUTION

Murthy Ch
Giga Sage

Hello @Joel O 

You can check the @OlaN response as well but never tried it.

If you wanna go with script try like below:

var formatUserName = JSON.parse(JSON.stringify(fd_data._2__parse_email_body_text.email_variables.Employee));  //replace the key name with actual name and check the code
formatUserName = formatUserName.split(",");
return formatUserNamestr[1].trim() + " " + formatUserName[0].trim();

(=tested)

Let me know if you stuck anywhere

Thanks,
Murthy

View solution in original post

8 REPLIES 8

OlaN
Giga Sage
Giga Sage

Hi,

You can either script this, or use the transform functions to parse the name in the correct format.

If you're using the no-code approach with the transform functions, you will need to store the data in two flow variables.

First use a split transform, using the comma-sign as a delimiter will split the name in two parts.

Then apply the transform function (in utilities) to store the two parts in two different flow variables (one for first name, and one for last name).

Finally add these two variable-data together in the correct order, where you need to use the full name.

See example below.

flow-transform-functions.png

Hi @OlaN 

 

Looked into your solution and looks like the variables seem to be working as I'm looking at my current execution details. Here is a sample of the Flow setup, however in my execution I get an error when submitting the catalog item. I am able to submit the same catalog item manually and prior to adding the Flow variables, the parsing was working as expected. 

 

Screenshots of setup and error:

JoelO_0-1730342705216.png

First Name
JoelO_1-1730342746163.png

Last Name
JoelO_2-1730342766367.png

Add variables

JoelO_4-1730343032232.png

 

Error Log in execution details 
JoelO_3-1730342869867.png

JoelO_5-1730343105606.png

 

Hoping you can assist and shed some light on what this might mean. 

 

Thank you. 

 

I believe the issue is that there is some mismatch between the result/output from your first step and the required input into the Flow variables.

Is the output from your first step some sort of array ?
You might need to store the unconverted full name in a string before you begin processing the parts of the name in your Flow variables.

Hi @OlaN 
Reviewing the logs deeper it appears I do have it set as a string in my first step in parsing out the email variables, which not realizing it when I use that variable in the Flow Variables that I set up it would do the same and grab the entire list.
Step 1:

JoelO_0-1730465572638.png

Step 2: 

JoelO_1-1730465652747.png

 

To your point of storing the unconverted full name, could you provide guidance on how I can begin to extract that from the entire string?

 

Thank you for your assistance