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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Set variable as an inc...
Power Automate
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

 

 

Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    on at

    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard