cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Extract text/digits from teams chat, then look up in Excel

Hi, looking for any assistance, if possible, this is the main goal:

 

1-An user will write in a group chat the "OPP-##########" (will always be 10 digit code plus the OPP-). The OPP# and general message will vary, for instance it can be:

"Hi all, I have this OPP-########## to discuss today" 

"these are for today OPP-#########, OPP-##########"

2-Extract the "OPP-##########" and then VLookup in an excel file to bring key data such as Date, Status, Owner, etc..

 

This is my flow so far, but having trouble.

 

Robotech12_1-1692940775924.png

 

Robotech12_3-1692940830501.png

I am not sure if my process is correct, having difficulties to set the body of the teams message in a variable.

 

any help is appreciated. Thank you.

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi, @trice602 thank you,  just managed to make it work ! this is the snapshot. Now I am getting the message correctly. Just wanted to know, the flow gets 1 OPP, but what happens if there is 2 Opps in a message? would it be more difficult? when " when keywords are mentioned in teams chat" can work?

 

thank you for the  help

 

Robotech12_0-1693252421891.png

 

 

 

 

View solution in original post

Hi @Robotech12 ,

 

That's great!  I am really happy for you!  Here's my recommendation:  mark this post as a solution to help others find it quickly, and then create a new post question, suggesting... "I have a working flow that takes on OPP-1234567890 from a message and I am getting my results, etc, etc - works great!  I now want to build onto this and check for more than one OPP-12345678 in a message.  How can I do that?

 

A new thread is going to help others jump into the conversation (and I will also too).

 

 

If this was helpful: Please mark as a solution Give me a thumbs up Always glad to help, Tom! Connect on LinkedIn

View solution in original post

16 REPLIES 16

Hi @Robotech12 ,

 

Here's a similar flow that may be a good example to help out.

 

trice602_0-1692941728530.png

 

First, I parse json to get my lookup value that I want to find in Excel, then List rows present in a table.

 

trice602_1-1692941784647.png

 

Next, I filter my array to find the chat message variable and find it in my Excel table.  Then I parse json the results from my filter array.

 

trice602_2-1692941903951.png

 

Next I am returning the results in Teams for the end-user

 

trice602_3-1692942006661.png

 

{
  "type": "AdaptiveCard",
  "body": [
    { 
      "type": "Image",
      "url": "https://somwhere-my.sharepoint.com/aaaaaaa/bbbbbbbbbbbbbb/Documents/logo2.png"
    },

   {
      "type": "TextBlock",
      "text": "Hello, here's the latest update.",
      "size": "Large"
    },
   {
      "type": "TextBlock",
      "text": "Always glad to help! The Robots 🤖",
      "size": "Large"
    },
   {
      "type": "TextBlock",
      "text": "ID no: @{items('Apply_to_each')['ID_no']}",
      "size": "Large"
    },
   {
      "type": "TextBlock",
      "text": "Current Status: @{items('Apply_to_each')['Status']}",
      "size": "Large"
    },
   {
      "type": "TextBlock",
      "text": "Last Comment: @{items('Apply_to_each')['Comments']}",
      "size": "Large"
    },
   {
      "type": "TextBlock",
      "text": "Updated by: @{items('Apply_to_each')['UpdatedBy']}",
      "size": "Large"
    },
    {
      "type": "TextBlock",
      "text": "Please select an option:",
      "wrap": true
    }
  ],
  "actions": [
    {
      "type": "Action.Submit",
      "title": "Send Follow-up 📨",
      "data": {
        "selectedOption": "Option 1"
      }
    },
    {
      "type": "Action.Submit",
      "title": "Escalate to Tier 2 🆘",
      "data": {
        "selectedOption": "Option 2"
      }
    }
  ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}

 

The results look like this:

 

trice602_4-1692942137698.png

 

If this reply was helpful, please mark as a solution so others can find it quickly too!

 

 

If this was helpful: Please mark as a solution Give me a thumbs up Always glad to help, Tom! Connect on LinkedIn

 @Robotech12 

The quickest way to extract the code will be to use a regex query on the text provided using Encodian's action. The below will extract an array of values that follow your desired pattern i.e. "OPP-" followed by 10 digits.

AlexEncodian_1-1692972813874.png

 

 

FYI – Encodian actions with the “Utility“ prefix only consume 1/20th of an Encodian action count . For example, a Standard plan has 500 actions so utility actions can be used 500x20 = 10,000 times. They are designed to be an incredibly cost effective productivity boost for your flow builds! 

---
 *Encodian Flowr is a Standard Power Automate connector with 100+ actions to supercharge flow builds. Conversion, merging, splitting, OCRing, data extraction, QR/Bar codes, searching and much more. And we just added "Utility" actions, which are almost free to use and accelerate solution builds and remove maintenance overheads with actions like Extract text between values, extract URLs, extract email addresses, Password/GUID/HMAC creation, escaping/unescaping HTML, parsing HTML tables, etc. 

Hi @trice602 thank you for the feedback, is the below correct ? I do not have much experience in JSON.

 

Do I need to modify this code to get the OPP-##########(10 digits)?

Robotech12_0-1692990540959.png 

 

Is this one corret? The Opportunity ID will be the actual OPP-######### in the Excel file.

Robotech12_1-1692990591340.png

 

I am not sure on how to modify the PARSOn Jason 2 part, is similar to the 1st one?

 

Robotech12_2-1692990643150.png

 

Robotech12_3-1692990695160.png

 

Hi @Robotech12 ,

 

In my example the chat messages are just the ID# and end-users are instructed to just key in the number for the status.  

 

The scheme for Parse json comes from the output of the previous step and you copy the output and click on Generate from sample and paste it in and it will build it for you.  You would do here and also after the filter array, you need to parse the json and get your scheme.

 

trice602_0-1692992943692.png

 

To find OPP-XXXXXXXX in the content of a message, you will need to add a compose here and get the number only with this expression.  Please keep in mind this is going to find one OPP# in the message, it's not coded to lookup more than one.

 

split(body('Parse_JSON')?['body']?['content'], '-')[sub(length(split(body('Parse_JSON')?['body']?['content'], '-')), 1)]

 

 

 

trice602_1-1692993080732.png

 

trice602_2-1692993275767.png

 

Update your Filter array to find the number in the Excel sheet.

 

trice602_3-1692993369278.png

 

 

If this was helpful: Please mark as a solution Give me a thumbs up Always glad to help, Tom! Connect on LinkedIn

Thank you @trice602  I just made the changes:

 

1-I changed In "Get message details" to Message ID

Robotech12_0-1692998851008.png

2-From the "Get Message Details" I did a test and got the Outpot and copied, then I generate from Sample to get the Schema.

Robotech12_1-1692998918007.png

in compose I put the Split expression

Robotech12_2-1692998961030.png

but I am getting an error:, is because the Jparson I wrote incorreclty the Jparson?

 

Robotech12_3-1692999145361.png

 

Hi @Robotech12 ,

 

What was the chat message?  In this example, with the extra compose, it is looking for OPP-XXXXXXXXX.

 

 

If this was helpful: Please mark as a solution Give me a thumbs up Always glad to help, Tom! Connect on LinkedIn

I wrote these examples @trice602 

 

I have OPP-1234567890 for today
For OPP-1234567890 need to talk with John


Hi @Robotech12 ,

 

Ok, I modified my example because it was just an example anyway and made this work for yours.  Here are the results:

 

trice602_0-1693003062271.png

 

My excel sheet:

 

trice602_1-1693003112464.png

 

I added these two steps:

 

trice602_2-1693003171741.png

 

This step is going to find the starting position of OPP in your messages and bring back the character number.

 

trice602_3-1693003237889.png

 

The compose directly above the Filter array is a substring.  We want the text starting in character position number of OPP and then next 14 characters, so we get a result like OPP-1234567890

 

substring(body('Parse_JSON')?['body']?['content'],body('Find_text_position'),14)
 
trice602_4-1693003351514.png

 

Make sure your flow looks exactly like this example, with the exception of an adaptive card, you could just return the results as a message, but I used a default card sample, added a logo for testing, and works.

 

trice602_5-1693003504892.png

 

Second test results...

 

trice602_6-1693003580535.png

 

If this was helpful. please mark as a solution.  I will be glad to help you get your project up and running this weekend; I am pretty much just building flows for the next 48 hours (give or take a little sleep in between)!

 

 

If this was helpful: Please mark as a solution Give me a thumbs up Always glad to help, Tom! Connect on LinkedIn

Thank you @trice602 , just doing it, but I am doing something wrong, but not sure where. Apologies in advance for all the questions.

 

 

On the 2nd step, am I correct here? In "get message details", should it be the "Message Id" ?

 

Robotech12_0-1693239817836.png

 

To generate the Parse JSON, I run a test and copy the Outpot Body and Generate.

 

 

Robotech12_3-1693240202667.png

Robotech12_5-1693240394528.png

 

but then I am getting this error:

 

Robotech12_6-1693240614660.pngRobotech12_7-1693240665768.png

 

 

Hi @Robotech12 ,

 

I think you are really close here, always glad to help!

 

Yes, the Message ID is what you will use but notice yours is in an apply to each and not needed.  Delete that entire Apply to each and re-enter your Get message details as shown below.  Your trigger and first step should look exactly like this:

 

trice602_0-1693241431222.png

 

On Parse JSON and Find Text Position --

 

Yes, you run it and get your sample JSON.  When you go to the Parse JSON action, in your scheme, it should be completely blank when you originally started.  Now, highlight all the text and delete it.  Click on the Generate from Sample button and that's where you paste in your sample JSON, this will create the scheme for you.  Your scheme is not correct and is the root cause and your find text position action is looking for text and should be content.  

 

trice602_1-1693242068336.png

 

 

 

 

 

If this was helpful: Please mark as a solution Give me a thumbs up Always glad to help, Tom! Connect on LinkedIn

Hi thank you @trice602 

 

Trying that part but every time I choose the "Get message details" and write "Message ID", the "apply to each" pops up every time. I have tried to move it out but not possible. is there an issue or configuration?

 

Robotech12_2-1693245605904.png

 

Robotech12_3-1693245635349.png

 

 

Robotech12_1-1693245551998.png

 

 

 

 

 

Hi @Robotech12 ,

 

The issue here is the trigger you are using is going to fire on the entire Team ecosystem, whereas mine is limited to a single chat channel and is the root cause why this wraps in an apply to each.  Please see my example:

 

trice602_0-1693246004033.png

 

My example "When a new channel message is added":

 

trice602_1-1693246150554.png

 

 

If this was helpful: Please mark as a solution Give me a thumbs up Always glad to help, Tom! Connect on LinkedIn

Hi, @trice602 thank you,  just managed to make it work ! this is the snapshot. Now I am getting the message correctly. Just wanted to know, the flow gets 1 OPP, but what happens if there is 2 Opps in a message? would it be more difficult? when " when keywords are mentioned in teams chat" can work?

 

thank you for the  help

 

Robotech12_0-1693252421891.png

 

 

 

 

Hi @Robotech12 ,

 

That's great!  I am really happy for you!  Here's my recommendation:  mark this post as a solution to help others find it quickly, and then create a new post question, suggesting... "I have a working flow that takes on OPP-1234567890 from a message and I am getting my results, etc, etc - works great!  I now want to build onto this and check for more than one OPP-12345678 in a message.  How can I do that?

 

A new thread is going to help others jump into the conversation (and I will also too).

 

 

If this was helpful: Please mark as a solution Give me a thumbs up Always glad to help, Tom! Connect on LinkedIn

Hi, sorry to activate this post again, this flow was working flawlessly. I was doing exactly the same steps for another chat but now I am getting this error, I am totally lost @trice602 , any help is appreciated,. I have tried several times and is the same. It crashes in the "Find text position".

 

this is the error:

 

"Evaluation of inputs for the expression action of kind 'IndexOf' failed: 'Required property 'text' expects a value but got null. Path ''.'."

 

Robotech12_0-1693509578180.png

 

Hi @Robotech12 ,

 

No worries, glad to help!  Here's the next steps:

 

1) Create a new post

2) Show the flow

3) show the error

4) AND please show the text it is trying to use in Find text position

 

 

 

I will also look for your new post and join the conversation (and please tag me in it).

 

 

If this was helpful: Please mark as a solution Give me a thumbs up Always glad to help, Tom! Connect on LinkedIn

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (948)