Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Unanswered

Set variable as an incident number number found in the subject of an email

(0) ShareShare
ReportReport
Posted on by 5

I know this is fairly easy, but I'm unable to figure it out...

 

I have a flow that creates takes a ms form input, sends out an email to ServiceNow with the form input, and waits for the ticket creation verification email in a shared mailbox.  At this point, I need to extract the incident number from the servicenow ticket response email and add the ticket number to the original input and send ticket number + original form input out in a new email

 

I can't figure out how to extract the incident number from the subject of the returned email and store it in a variable for use later.  The servicenow ticket is always returned in the same format in the email: INC0048420

 

 

  • v-xida-msft Profile Picture
    on at
    Re: Set variable as an incident number number found in the subject of an email

    Hi @cgo84,

     

    Could you please share a screenshot of your flow's configuration?

    Could you please share an sample of the subject of the returned email?

    Further, do you want to get the 'INC0048420' from the subject of the returned email?

     

    I assume that the Subject of the returned email shows as below:16.JPG

     

    If you want to extract the incident number (INC0048420) from the Subject, please take a try with the following workaround:

    • Add a "When a new email arrives" trigger.
    • Add a Variables-> "Initialize variable" action, Name set to Incident ID, Type set to String and Value set to empty.
    • Add a Compose action, Inputs field set to following article:
    substring(triggerBody()?['Subject'],indexOf(triggerBody()?['Subject'],'INC'),10)
    • Add a "Set variable" action, Name choose Incident ID and Value set to output of "Compose" action (Click "See more" to see the Dynamic content).

    Image reference:17.JPG

    The flow works successfully as below:18.JPG

     

     

    Please also check if the following article would help in your scenario:

    https://powerusers.microsoft.com/t5/Building-Flows/Html-To-Text-End-Of-File-Check/m-p/106260/highlight/true#M10406

     

    More detauils about using expression in flow actions, please check the following article:

    Use expression in flow actions

     

    If you could provide more details about the Subject of the returned email from ServiceNow ticket, we would provide a proper workaround for you.

     

     

    Best regards,

    Kris

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,587 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,928 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow