web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Reading E-mail subject
Power Automate
Suggested Answer

Reading E-mail subject

(0) ShareShare
ReportReport
Posted on by
I'm working with a camera project and cameras sends mail when someone is in the detection Area. The subject looks like this “SBKs AcuSense NVR: intrusion On Channel D1”.

If have written some code that extracts the Channel number, in this case D1.

substring(triggerOutputs()?['body/subject'], 31, 2) and it works

But now if would like to add code so that D1 is House, D2 Boat Yard….

This works but when I add more if’s (instead of 'Unknown') it does not work
if(
    equals(toUpper(substring(triggerOutputs()?['body/subject'], 31, 2)), 'D1'),
    'House',
    'Unknown'
    )

I have asked CoPilot but no help there.
Categories:
I have the same question (0)
  • CFernandes Profile Picture
    8,504 Most Valuable Professional on at
    Hey Mate, Something like this? 
     
    if(
      equals(toUpper(substring(triggerOutputs()?['body/subject'], 31, 2)), 'D1'),
      'House',
      if(
        equals(toUpper(substring(triggerOutputs()?['body/subject'], 31, 2)), 'D2'),
        'Boat Yard',
        if(
          equals(toUpper(substring(triggerOutputs()?['body/subject'], 31, 2)), 'D3'),
          'Garage',
          'Unknown'
        )
      )
    )
     
     
     
    If it helped you, please click "Does this answer your question?" and give it a like or mark it as Solution, it helps others in the community find answers more easily!
    Connect With Me:
    💼 LinkedIn: Clavin Fernandes
    📺 YouTube: Clavin Fernandes
    📝 Blog: clavinfernandes.wordpress.com
    🌐 Community Website: PPUG.org
    👥 Join our Community: Power Platform User Group
  • Suggested answer
    David_MA Profile Picture
    14,956 Super User 2026 Season 1 on at
    If I am understanding correctly, I would create a SharePoint list to store the values. Something like this:
    Title Code
    D1 House
    D2 Boat Yard
    D3 Unknown
     
    Ensure that the Title column is set to unique values. When your flow runs, use a Get items action against this list with a filter query where Title eq '[Your Value]' 
     
    Since the title column is set to unique values, it should return one value. When you get the value, the flow will still want to process it with an apply to each, but as long as one row is returned it should be the value you want to use.
     
    This way, if you need to add new codes, you just have to add them to the list and don't need to update your flow.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard