Error is:
Unable to process template language expressions in action 'Initialise_SubjectTrimmed' inputs at line '0' and column '0': 'The template language expression 'trim(split(split(variables('EmailSubject'),'Issue ')[1],':')[0])' cannot be evaluated because array index '1' is outside bounds (0, 0) of array. Please see https://aka.ms/logicexpressions for usage details.'.
My code is:
trim(split(split(variables('EmailSubject'),'Issue ')[1],':')[0])
What I'm trying to do:
The code takes the subject from an email and tries to find the text between "Issue " and ":". For example, if the email subject is "Issue 123: something is broken", the output is 123.
The problem:
If the Issue text exists, the script functions normally. I have configured a runafter if the above action fails (eg there was no issue text) and the entire script functions. However, this triggers the above error and the flow is considered a failure. Ultimately I don't care about the error as I'm handling it, but this problem is making it hard to debug other errors as it's giving me false positives.
Solved! Go to Solution.
Hi @Imrhien ,
Are you trying to split the string by the keyword "Issue"?
I suggest you add a Condition action to compare whether "Issue" is included in the string before splitting.
Hey @Imrhien
Can't test this currently, but try this expression for this:
split(split(variables['EmailSubject'],':')[0],' ')[1]
So, in the above expression, first I am splitting the string where colon is. Then taking the 0 index value.
So, if we take the example
Issue 123: Error
Then after first split the expression would look like this:
[Issue 123], [Error]
Then in the second split I am taking Issue 123 and splitting it at a space and as I want 123 I am using [1] to extract it.
I hope this helps. 🙂
Hi Sundeep,
That's a cool way to do it - but if the email subject is "Re: Issue 123: error", I assume that this won't work because it'll start parsing at the first colon.
Hi @Imrhien ,
Are you trying to split the string by the keyword "Issue"?
I suggest you add a Condition action to compare whether "Issue" is included in the string before splitting.
Thanks Dehzi, that's a great solution. That has solved my problem 🙂 I've re-organised my flow to fit this logic.
For anyone else trying this, I also added an IsInteger check afterwards in case someone uses the word "Issue " but doesn't follow it with a number.
User | Count |
---|---|
102 | |
37 | |
31 | |
24 | |
16 |
User | Count |
---|---|
132 | |
53 | |
53 | |
37 | |
26 |