Parse the subject line in an email using power automate

Brass Contributor

Hello - I am trying parse the subject in a new email using power automate.  The subject would look something like 123456-7890.

 

I need to parse the string before the dash and after the dash to load into 2 separate fields in a sharepoint list item.  I was trying something like this, but to no avail....

 

split(triggerBody()?['Subject'],'-')
4 Replies

I was able to resolve this.@rbutgins21 

@rbutgins21 

 

I know this is an old post but can you share how you solved this.

@remedina  

last(split(variables('Subject'),'-'))

first(split(variables('Subject'),'-'))

@rbutgins21235 

Thank you for you quick reply to this old post. What Im trying to accomplish with my flow is:

  1. when email arrives to mail box 
  2. get subjct so i can use to rename attachmnet
  3. add renamed attachment  to to share point site document library.

The first two work but on the third it fails with 

The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@outputs('Compose_2')' is of type 'String'. The result must be a valid array.

not sure why or what is causing this. 

I must admit Im no expert with power automate.

 

Any ideas.

 

Thanks again