cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
seussiii
Advocate I
Advocate I

Help updating items via adaptive card

I'm rather new to PA/adaptive cards so I appreciate any help.

 

Scenario is...

I have a MS form which places answers to questions in a SP list. Then an adaptive card is shuttled off to a teams channel that displays the users info. The card includes a new text field that I can enter information in which will then update a column in the original SP list item.

 

Tried to follow this guide and hit a wall as it deals with creating a new item vs editing existing.  "Collect response from a user with Adaptive Card in Teams using Power Automate"

 

How can I get the text field to directly reference the existing field for the list item in question? and then update that field on submit. I have a feeling it has something to do with the "id":SimpleVal" listed in the Input.Text JSON but not sure how to make the connection.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

The dymanic content from the response is a known issue with the Power Automate team. Audrie has posted this video to show how to get the results.

 

https://www.youtube.com/watch?v=RoRQdX1mdLw

 

'outputs('<nameofpostaction>').body.data.CouponCode'

or

'outputs('<nameofpostaction>')?['body']?['data']?['CouponCode'] - This is what I use most often when I have to write an expression to pull in a field from an action I cannot find in the dropdown.

View solution in original post

10 REPLIES 10
sudharsan1985
Solution Sage
Solution Sage

Hi @seussiii 

Based on your clarification, I suggest you follow the below steps

  1. From the result of the 'Post an Adaptive Card to a Teams' user and wait for a response' action, you should know the responder info such as email, userprincipalname.
  2. Using the above information, you can drag the action 'Get Items' and using the 'Filter Query' you can find the items that are created by the user.
  3. Add a condition action and check for the length of the items, if it is > 0 then add an action 'Update Item' and use the 'ID' from the 'Get Items' action. If the length is < 0 then add 'Create Item' action and create the item in the list.

Hope it helps, please like it or mark it as a solution if it resolves ur clarification or issue

-Sudharsan K...

Hope it helps, please like it or mark it as a solution if it resolves your clarification or issue
-Sudharsan K...
v-litu-msft
Community Support
Community Support

Hi @seussiii,

 

@sudharsan1985 is correct, now the "Post an Adaptive Card to Teams channel and wait for a response" is available.

Let me just add a point, there is the Responder field could be used to filter the item related in SharePoint list, the responder is JSON format, so if want to used in the Filter query should extract it:

body('Post_an_Adaptive_Card_to_a_Teams_channel_and_wait_for_a_response')['responder']?['email']

Annotation 2020-03-05 164535.png

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I should have done this from the start but hope this clarifies things a bit. Background: I'm technical but in a different specialty. Not a dev and not familiar with JSON. I'm trying to break this down, learn it, and provide my group with some nice workflow solutions. That being said, I appreciate the quick replies and any help given since I'm still pretty much a newbie.

 

Basically the customer will go to the form, enter their info and place their order for a quantity of oranges/apples. It places that order in the SP list and then creates the adaptive card. Up to this point i think i have it figured out. 

 

See below for full screenshots and card Json

 

Currently i have nothing after "Post an Adaptive Card to a Teams channel and wait for a response". This is where I am really confused. Logically, I would think that I would add an SP action "Update item". I figured there would be teams related "dynamic content" to choose from as a source followed by a way to set the destination column of the target "List Name". 

 

I played around with it am am missing something related to the IDs...i'm sure of it. I got the flow to update the column in question but with what looked like a unrelated number to what was entered in the card. I took it back to bare bones after that.

 

Does this make more sense?

 

image.pngimage.pngimage.png

{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "Input.Text elements",
"horizontalAlignment": "Center"
},
{
"type": "TextBlock",
"text": "Name: @{outputs('Get_response_details')?['body/r87ab26714bed4d23b008f83aeab9b1fc']}"
},
{
"type": "TextBlock",
"text": "Email: @{outputs('Get_response_details')?['body/rc7fbb4745d3b4ac2ab35931e5eb82615']}"
},
{
"type": "FactSet",
"facts": [
{
"title": "Oranges -",
"value": "@{outputs('Get_response_details')?['body/r29dd65ec50f74c9b8aa0298668e45b07']}"
},
{
"title": "Apples -",
"value": "@{outputs('Get_response_details')?['body/r865cf85a9033401ca9cd7391b9cf5d07']}"
}
]
},
{
"type": "Input.Text",
"placeholder": "Coupon Code",
"maxLength": 0,
"id": "SimpleVal"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Submit",
"data": {
"id": "1234567890"
},
"style": "positive"
}
]
}

 

In my example i'm actually trying to place the users text input "coupon code" in the adaptive card and have it update the sp list coupon code column (which should be empty)

So is your problem getting the information back from the Adaptive Card input? Audrie has a YouTube video going over some of the breaking changes that have happened recently with the post and wait for a response. https://www.youtube.com/watch?v=RoRQdX1mdLw

 

Now as to how to update the record you're right. You'd need to use the SharePoint Update Item, however you need to know what item to update. 2 options-

 

1 - Initialized a variable before the apply to each action. Inside the apply to each action append or set the variable to the id of the record that gets created. Use this variable's dynamic content to identify the record you'd like to update.

 

2 - On the Adaptive Card itself set a input.number to the value of the id (this requires the Post Card Action to be within the Apply to each). Set the value property of the input number to the id of the record, and give it a isVisable property of false. when you pass the 'coupon code' back it will also include the SharePoint ID under the name of the id you give the input.number.

https://adaptivecards.io/explorer/Input.Number.html

@crf2011 

Thank you. Slowly starting to get it. I tried both options but could only manage to get option 2 working. 

 

Currently its working: Post card straight to Update Item within an Apply to Each. I'm almost there. I used input.text as the code is alphanumeric. I'm sure its simple and I'm missing it but how to I reference "id": "CouponCode" (the input text entry) from the Coupon code field in the update item action in flow? Hope that makes sense.

 

"type": "Input.Text",
"placeholder": "Coupon Code",
"maxLength": 0,
"id": "CouponCode",

 

image.png

The dymanic content from the response is a known issue with the Power Automate team. Audrie has posted this video to show how to get the results.

 

https://www.youtube.com/watch?v=RoRQdX1mdLw

 

'outputs('<nameofpostaction>').body.data.CouponCode'

or

'outputs('<nameofpostaction>')?['body']?['data']?['CouponCode'] - This is what I use most often when I have to write an expression to pull in a field from an action I cannot find in the dropdown.

As a follow up, I took crf2011's advice and used 'outputs('<nameofpostaction>')?['body']?['data']?['CouponCode'] . Tried outputs('OrderWaitAction')body.data.CouponCode and there was no "data" in the autcomplete.

 

Thanks guys.

EricMoore
New Member

So Far so Good and thanks for posting this. 

 

I think I have a different problem.  When getting the dynamic content back from an Adaptive card with a Wait action, it works great if I don't include any dynamic content in the card from the previous step (a form). The moment I drop the contents of part of the Form Response into a Text Box in the Card, there's no output. 

        {
            "type": "TextBlock",
            "text": "",
            "weight": "Bolder",
            "size": "ExtraLarge",
            "spacing": "None"
        },
        {
            "type": "Input.Text",
            "id": "acComment",
            "placeholder": "Comments",
            "isMultiline": true
        }

 will give me output into acComment

        {
            "type": "TextBlock",
            "text": "@{body('Get_response_details')?['r3a9764d06ef946ae862d701277111c8c']}",
            "weight": "Bolder",
            "size": "ExtraLarge",
            "spacing": "None"
        },
        {
            "type": "Input.Text",
            "id": "acComment",
            "placeholder": "Comments",
            "isMultiline": true
        }

will not... 

I appreciate this is preview code - but have I missed something? 

Just to Clarify - I do appear to be able to get the output in the manner Audrie describes, I just thought it was useful to share the slightly different use case that fails. 

 

Helpful resources

Announcements

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!    

Welcome to the Power Automate Community

You are now a part of a fast-growing vibrant group of peers and industry experts who are here to network, share knowledge, and even have a little fun.   Now that you are a member, you can enjoy the following resources:   Welcome to the Community   News & Announcements: The is your place to get all the latest news around community events and announcements. This is where we share with the community what is going on and how to participate.  Be sure to subscribe to this board and not miss an announcement.   Get Help with Power Automate Forums: If you're looking for support with any part of Power Automate, our forums are the place to go. From General Power Automate forums to Using Connectors, Building Flows and Using Flows.  You will find thousands of technical professionals, and Super Users with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Power Automate community forums. Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered. Galleries: The galleries are full of content and can assist you with information on creating a flow in our Webinars and Video Gallery, and the ability to share the flows you have created in the Power Automate Cookbook.  Stay connected with the Community Connections & How-To Videos from the Microsoft Community Team. Check out the awesome content being shared there today.   Power Automate Community Blog: Over the years, more than 700 Power Automate Community Blog articles have been written and published by our thriving community. Our community members have learned some excellent tips and have keen insights on the future of process automation. In the Power Automate Community Blog, you can read the latest Power Automate-related posts from our community blog authors around the world. Let us know if you'd like to become an author and contribute your own writing — everything Power Automate-related is welcome.   Community Support: Check out and learn more about Using the Community for tips & tricks. Let us know in the Community Feedback  board if you have any questions or comments about your community experience. Again, we are so excited to welcome you to the Microsoft Power Automate community family. Whether you are brand new to the world of process automation or you are a seasoned Power Automate veteran - our goal is to shape the community to be your 'go to' for support, networking, education, inspiration and encouragement as we enjoy this adventure together.     Power Automate Community Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Users online (4,642)