I am trying to get some data parsed out of a subject line in Office 365 Flows. I have an email that has a consistent format:
Help Desk [Ticket #12345] I want to get the number '12345' for use in later steps in the flow. So far, I've attempted to use the substring expression in a compose connector:
substring(triggerBody()?['Subject'], 20, 5) But I get an error about the string being null.
1 Answer
Besides the index being incorrect (to retrieve '12345' from Help Desk [Ticket #12345] you need to use substring(value, 0, 5) as the index is 0-based), the expression looks correct. But you can take a step-by-step approach to see what is wrong.
To start, take a look at the flow run to see exactly what the trigger outputs are: 
If you see the Subject field (as I do in my case), create a variable containing that value only to make sure that you don't have any typo: 
If it works correctly, then you should see in the flow run the subject: 
If everything is still good at that point, create a new variable with the substring that you want: 
If you got to this point, then you should be able to retrieve the ticket id.
2