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

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

Hi @Murthy Ch 

Thank you for your reply. 

Could you advise where this script would be applied?

 

Regards,

Hi @Murthy Ch 

Thank you for your assistance. 

 

Just providing some context on here on your solution to this from a scripting standpoint. Since the scripting option is not available at the OOB Action-"Submit Catalog Item Request", a manual Action needed to be created.

 

Create Action steps

1. We created the Action and include add the Inputs of my RITM, Employee and Supervisor fields (or whatever your requirements are in your scenario).

 

2. In the "Script step" add your input variables and write a script (GlideRecord) on querying the inputs of those variables and associate it to your variables on the catalog item. 

 

Within the Flow

1. Then in my Flow for that catalog item, I had to add an Action step and select the newly created Action and add the script (look at post from @Murthy Ch above) to each variable. Adjust script to your setup or specific use case. 

 

I appreciate your assistance @Murthy Ch 

PujaKar
Tera Contributor

I am unable to do that with is action, I have posted my detail query in this below link:

How to parse email body text in flow designer inbound email? 

If possible please check this and help me to resolve this issue.