
Hello Community,
Previously I had designed a workflow that was able to extract key bits of information from an email and store it in Sharepoint. However, I am no longer able to get this to work. Not sure what has changed. The email contains the following Information:
Enter your email to subscribe: test1@test.co.uk
Referral Code:
Consent: on
utm_source:
---
Date: April 15, 2021
Time: 3:29 pm
The flow is shown below: Whilst the error occurs on the email: The flow is not working as designed. As an example, the Get UTM Source should get the data after UTM_Source in the email even if it is blank.
The expression for get utm_source is as follows
trim(trim(substring(body('Html_to_text'),add(indexOf(body('Html_to_text'),'utm_source '),11),sub(indexOf(body('Html_to_text'),'---'),add(indexOf(body('Html_to_text'),'utm_source '),11)))))
The expression for get email is:
trim(substring(body('Html_to_text'),add(indexOf(body('Html_to_text'),'Enter your email to subscribe: '),31),sub(indexOf(body('Html_to_text'),'Referral Code: '),add(indexOf(body('Html_to_text'),'Enter your email to subscribe: '),31))))
Any help to resolve this is appreciated.
Hi @agrawa1a
Your alternative is to split the string into an array.
If you want to give this a go quickly, copy (Ctrl +C) and paste the below code into a flow, New Step -> My ClipBoard and Ctrl + V
{"id":"db72f9db-4651-446d-9375-f93f-ee2e1725","brandColor":"#8C3900","connectionReferences":{},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"DamoBird365","operationDefinition":{"type":"Scope","actions":{"Compose":{"type":"Compose","inputs":"Enter your email to subscribe: test1@test.co.uk\nReferral Code:\nConsent: on\nutm_source:\n\n---\nDate: April 15, 2021\nTime: 3:29 pm","runAfter":{}},"ReturnLine":{"type":"Compose","inputs":"\n","runAfter":{"Compose":["Succeeded"]}},"Split2Array":{"type":"Compose","inputs":"@split(outputs('Compose'),outputs('ReturnLine'))","runAfter":{"ReturnLine":["Succeeded"]}},"Select":{"type":"Select","inputs":{"from":"@outputs('Split2Array')","select":"@split(item(),': ')?[1]"},"runAfter":{"Split2Array":["Succeeded"]},"description":"split(item(),': ')?[1]"},"AValue":{"type":"Compose","inputs":"@{body('Select')?[0]}\nbody('Select')?[0] etc 1,2,3\n@{body('Select')?[1]}\n@{body('Select')?[2]}\n@{body('Select')?[3]}","runAfter":{"Select":["Succeeded"]}}},"runAfter":{}}}
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien
P.S. take a look at my new blog here