I have a e-commerce email that notifies me of any new orders, like so:
COLOR 1 BLUE
COLOR 2 RED
I would like to process the order information so as to create an array object named "Order" with the text in bold as keys and the plain text as the values. I can, in theory, place a delimeter between the two, (i.e SKU | 123456) to help with the split function, but have yet to find a way creat an array object and input the key value pairs as described above.
Hi @Mobutu1650 ,
I assume you're using the "when an email comes in" trigger.
You won't be able to do keypairs in an array as they're meant to be 1D. A riskier method would be creating 5 arrays and returning the pairings by [position], but I wouldn't recommend that.
There's an other variable type "object" which you could use. Are you familiar with JSON? If the emails are always exactly the same, you could split by spaces and count which objects would be the value in the key-value pairs. Create 5 variables, then you would have an apply to each loop on the split(emailbody,' ') value and a Switch statement (like if, but with many else branches) to get your 5 values and then use a Compose step to build the JSON like this:
"SKU": "[value from variable]",
"QTY": "[value from variable]"
Then you can set your object variable to the outputs of this Compose step
Thanks, but unfortunately, the products in question have a massive amount of options/configurations that make parsing the email content and iterating through all possible if/else conditions somewhat tricky. Wondering if it would be just easier to split the bolded and plain text and throw it in column excel column or list...