cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
WojciechJez
Regular Visitor

Creating / updating item in SharePoint List based on channel message in Teams

Hi,

I have created Issue Tracker (Lists) in Teams Channel. I have set simple flow - when a new message appears in channel with message subject: "SCAN STARTED" then create an item in Issue Tracker - and it works.

But now I want to create another flow which will modify/update above added item when a new message will appears with message subject "SCAN COMPLETED". Is it possible to create one flow which will collect data from this two messages? I will add that the time of appearing between this 2 messages is from 20 minutes till few hours.

Also I would like to add some values (strings and numbers) from message body directly to some columns, i.e. one of the lines in message body is "Scan scarted by: User1" I would to add this User1 to column "Issue created by", other example is "Problems found: 0" - number 0 I would like to add to column "Number of findings".

 

Best regards,

Wojtek

5 REPLIES 5

Couple of questions just to clarify how it would work, etc.

 

  1. After you've started a scan can you have another scan start before the first scan is completed?
  2. What field type is Issue created by? You said you wanted to add User1 - how would User1 be entered in the message? I'm assuming this is a text field given you mentioned update some values (strings and numbers) but just wanted to be sure.
  3. Would the format of the message be something that is auto-generated and in the same format each time?

From what you said it would look something like that below (is that correct, or something else)? Would be good to see an actual example of what you have.

 

grantjenkins_0-1665666379137.png

 


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.
WojciechJez
Regular Visitor

1. It can happen - but mainly I try not to do it.

2. Issue created by is a "Person or Group" and User1 is a AD login.

3. The messages are generated automatically. The format of first message (scan started) is different then second message (scan completed) but there will be no other formats. See the screen below.teams_channel_info.png

Those are emails send to Teams dedicated channel.

I'll see what I can come up with later today. I had something in the works, but need to change a few things as didn't realise it was an email being posted in, and subject also includes more ": Asset 1", plus Issue created by being a Person or Group field.

 

Just one question that's probably the most tricky part. How do you relate a completed scan to a started scan when there might be multiple started scans waiting for completion. This is in relation to you saying you might start a new scan before the first scan is complete. If you started a new scan before the previous one was finished would this new scan be for a different Site name, or potentially still the same Site name?


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.
WojciechJez
Regular Visitor

Different scan - different Asset - different subject 🙂

Of course after some time it can be another scan of the same asset but it will have different date, and the previous one will be closed (completed).

Finally got time to have another go at this one.

 

Assumptions:

  • Critical, Severe and Moderate are all summed to get total number of Problems found.
  • Scans will take at least 5 minutes to run.
  • The Teams channel only has the two types of messages

 

For this example, I'm using the following list. I added some column formatting for the problems.

grantjenkins_1-1667024731467.png

 

Status is type Choice.

Issue created by is type Person.

Critical, Severe and Moderate are type Number.

Number of findings is type Calculated that is the sum of Critical, Severe and Moderate.

Total scan time is type Single line of text.

 

The full flow is below. I'll go into each of the actions.

grantjenkins_1-1667021998900.png

 

The trigger is setup to wait for a new channel message in Teams.

grantjenkins_2-1667022052452.png

 

Html to text converts the HTML from the message to text.

grantjenkins_3-1667022095519.png

 

Compose splits the text by new line giving us an array of text items.

 

split(outputs('Html_to_text')?['body'], decodeUriComponent('%0A'))

 

grantjenkins_4-1667022166744.png

 

Filter array takes in the Compose output, skips the first row, and removes any empty lines.

 

skip(outputs('Compose'),1)
empty(item())

 

grantjenkins_5-1667022302592.png

 

Compose Convert to JSON converts the Filter array to JSON format. There's likely a better way to do this, but spent a long time researching and couldn't find anything 😞

 

replace(replace(replace(string(body('Filter_array')),': ', '": "'), '[', '{'), ']', '}')

 

grantjenkins_6-1667022383954.png

 

Parse JSON converts the output to proper JSON with the appropriate schema.

grantjenkins_7-1667022531767.png

 

{
    "type": "object",
    "properties": {
        "SCAN STARTED": {
            "type": "string"
        },
        "SCAN COMPLETED": {
            "type": "string"
        },
        "Site name": {
            "type": "string"
        },
        "Started by": {
            "type": "string"
        },
        "Critical": {
            "type": "string"
        },
        "Severe": {
            "type": "string"
        },
        "Moderate": {
            "type": "string"
        },
        "Total Scan Time": {
            "type": "string"
        }
    },
    "required": [
        "Site name"
    ]
}

 

 

The Switch uses the first row in the Filter array and splits it to get the header which will be either SCAN STARTED or SCAN COMPLETED.

 

split(body('Filter_array')[0], ':')[0]

 

grantjenkins_8-1667022663781.png

 

If it's SCAN STARTED it will create a new item using the Site name and Started by values.

grantjenkins_12-1667022987595.png

 

If it's SCAN COMPLETED it will return the latest item in the list (Order by = Created desc) where the Title is = SCAN - Site name and Status is Started. This should bring back the appropriate item that we need to update.

 

We then update the item returned using the ID of the first item from Get items (should always only be one but will still be within an array). We update Critical, Severe and Moderate converting them to integers.

 

first(outputs('Get_items')?['body/value'])?['ID']

int(body('Parse_JSON')?['Critical'])
int(body('Parse_JSON')?['Severe'])
int(body('Parse_JSON')?['Moderate'])

 

grantjenkins_0-1667024681706.png

 

Hopefully this works for you with the messages that come through from Teams. I tried to use what you had provided as samples.


----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.

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 (938)