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 / Issues Parsing Trackin...
Power Automate
Suggested Answer

Issues Parsing Tracking # and Due Date Fields from Email Content

(1) ShareShare
ReportReport
Posted on by 6
Hello,

I’m new to Power Automate and am building a workflow to track emails from a specific sender in a shared inbox and populate a SharePoint List. These emails usually have a standard subject line and body. The subject includes the tracking number and topic, and the body includes the due date. In my List, I’m capturing Tracking #, Title (for the subject line), Received, and Due Date.

I’ve been able to set up the workflow to pull the data, but I’m running into a couple issues that I cannot seem to solve.

Issue 1: Tracking Numbers
I’ve automated pulling the tracking number into the Tracking # field. However, when the subject line doesn’t contain a tracking number, the workflow inserts the entire subject line into the Tracking # field.  In those cases, I want the field to remain null.
 
An example subject line:
 
(PD-123456) Letter from Jane Smith: Questions about Services

I’m currently using this expression:

first(split(last(split(triggerOutputs()?['body/subject'], '(')), ')'))

Issue 2: Due Dates
This has been the most challenging part of the workflow. The due date is located somewhere in the body of the email, but its placement and format vary (for example: “February 25, 2026” or “2/26/2026”).  The Due Date column in my List is a Date type, and I’m fine with the result being null whenever the format doesn’t match something Power Automate can parse.  I fully appreciate that I can’t control how the sender formats the date.

I’ve tried several approaches but haven’t been successful.  The results either return null or the workflow fails. 

An example body:

Assignment – Inquiry: Name of message.

Leadership needs a response letter drafted.

Due 3 p.m. 2/26/2026.
Categories:
I have the same question (0)
  • David_MA Profile Picture
    14,090 Super User 2026 Season 1 on at
    If you are willing to get a subscription to Encodian Flowr— Easy document generation with Power Automate actions, this isn't too difficult and you can do this with the find text with RegEx action:
     
    The Compose action contains the text of your post. After the run:
    And:
    This is a utility action. If I remember, five uses equals one credit.
  • Suggested answer
    Haque Profile Picture
    1,419 on at
    Hi @JM-11031334-0,
     
    Based on your explained issues - handling tracking number is easy need a bit of work around.
     
    But bad luck is you need patience to handle the date as its format varies, you have tackle this varying different techniques.
     
    Let's dive into the issues:
     
    Issue 1: Tracking Numbers
    To make sure the Tracking # field remains empty when the subject line does not contain a tracking number in parentheses, you can modify the expression to check for the presence of parentheses first. If they exist, extract the tracking number; if not, return blank. - you can do this ff an only if you are sure tracking number coming inside parenthesis - at least we have to have something to check, right?
     
    Try this expression in Power Automate:
    if(
        and(
            contains(triggerOutputs()?['body/subject'], '('),
            contains(triggerOutputs()?['body/subject'], ')')
        ),
        first(split(last(split(triggerOutputs()?['body/subject'], '(')), ')')),
        ''
    )
    
     

    Issue 2: Due Dates

    The Due Date extraction challenge, as it varies in the email body

    Regular Expressions (Regex) can be our friend:

    1. Let's use the "Compose" action with an expression that applies a regex pattern to find date-like strings in the email body.
    2. Example regex patterns can match formats like MM/DD/YYYY, M/D/YYYY, or full month names like February 25, 2026.
    3. Power Automate doesn’t have built-in regex, but you can use the "Match" function in expressions 

    We have to try Multiple Date Extraction options:

    1. Use multiple Compose actions with different expressions to extract dates in different formats. For example, one expression to extract MM/DD/YYYY using substring() and indexOf(), another to extract Month DD, YYYY using split() and contains().
    2. Let's use a condition to check which extraction succeeded and pick the valid date. Get a narrow clue from here.
     

    Convert Extracted Text to Date:

    Either ways - if you have the date in place, use the formatDateTime() function to convert the extracted date string to a date type compatible with SharePoint. And at last if parsing fails, return null or empty to avoid flow failure.

    And lastly, If no recognizable date is found, set the Due Date field to null as you prefer.

     

    // Compose action expression to extract date after "Due"
    trim(
        first(
            split(
                last(
                    split(triggerOutputs()?['body/body'], 'Due')
                ),
                '.'
            )
        )
    )
    

    Note: This extracts the text after "Due" up to the next period, which you can then try to parse as a date.

     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!

     

  • JM-11031334-0 Profile Picture
    6 on at
    Unfortunately, I cannot seem to get the solutions from the previous two posts work.  If it helps, I'm working from the When a new email arrives in a shared mailbox (V2) operational trigger.  I don't have access to the V3 option.  Also, I don't seem to have access Encodian or authority to purchase it.  

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard