Skip to main content

Notifications

Topic Creation & Management
Unanswered

Dynamic adaptive cards with text inputs

Posted on by 6

Hello

 

I faced a problem with lack of native loop functionality in copilot studio. For client we are preparing solution which will:
1. Get a JSON data from azure function 

2. Ask user some questions to get missing values

3. Post result using http triggered Azure function

 

In point 2 we have to ask user to fill values for a list of objects like 

 

{
...
 nodes: [
 {
 name: String
 extrenalNumber: String
 },
 {
 name: String
 extrenalNumber: String
 }
 ]
}

 


As a solution we were thinking of
1. using some big dynamic adaptive card which will ask user to fill in inputText required values for all of objects 
2. create a loop that will post adaptive card foreach object 

 

Is there any way to complete such task with copilot studio or we should migrate to Bot Framework?

  • grogal Profile Picture
    grogal 6 on at
    Re: Dynamic adaptive cards with text inputs

    Hello
    I was able to run loop but now I faced problem with saving result of each iteration in some table. Could you advice?

    kind: AdaptiveDialog
    beginDialog:
     kind: OnRecognizedIntent
     id: main
     intent: {}
     actions:
     - kind: SetVariable
     id: setVariable_oKhUX0
     variable: Topic.nodesList
     value: =["Sql connection","Office connector"]
    
     - kind: SetVariable
     id: setVariable_2oJevH
     variable: Topic.currItem
     value: "\"\""
    
     - kind: SetVariable
     id: setVariable_bNfSqP
     variable: Topic.Var3
     value: =[]
    
     - kind: Foreach
     id: myForeach
     items: =Topic.nodesList
     value: Topic.currItem
     actions:
     - kind: SendActivity
     id: sendActivity_6HhMsS
     activity: "{Topic.currItem}"
    
     - kind: Question
     id: question_ZpGOlF
     interruptionPolicy:
     allowInterruption: true
    
     variable: init:Topic.Var2
     prompt: Please provide name
     entity: StringPrebuiltEntity
    
     - kind: Question
     id: question_aJJTv0
     interruptionPolicy:
     allowInterruption: true
    
     variable: init:Topic.Var1
     prompt: Please provide number
     entity: StringPrebuiltEntity
    
     - kind: SendActivity
     id: sendActivity_W12Lmj
     activity: OUT OF LOOP


    BTW I wasn't able to display adaptive card in loop. Code of adaptive card:

     - kind: AdaptiveCardPrompt
     id: MFN51m
     card: |-
     ={
     type: "AdaptiveCard",
     '$schema': "http://adaptivecards.io/schemas/adaptive-card.json",
     version: "1.5",
     body: [
     {
     type: "TextBlock",
     text: "Please put more details",
     wrap: true
     },
     {
     type: "Input.Text",
     id: "testNumber",
     placeholder: "testNumber",
     label: "testNumber"
     },
     {
     type: "Input.Text",
     id: "appName",
     placeholder: "Application name",
     label: "Application name:"
     }
     ],
     actions: [
     {
     type: "Action.Submit",
     title: "Submit",
     data: {
     testNumber: "testNumber",
     appName: "appName"
     }
     }
     ]
     }
     output:
     binding:
     actionSubmitId: Topic.actionSubmitId
     appName: Topic.appName
     testNumber: Topic.testNumber
    
     outputType:
     properties:
     actionSubmitId: String
     appName: String
     testNumber: String



  • adilei Profile Picture
    adilei on at
    Re: Dynamic adaptive cards with text inputs

    You can try exploring the schema using intellisense:

     

    adilei_0-1716464711564.png

     

  • grogal Profile Picture
    grogal 6 on at
    Re: Dynamic adaptive cards with text inputs

    Is there any documentation of this code editor possibilities? 

  • adilei Profile Picture
    adilei on at
    Re: Dynamic adaptive cards with text inputs

    For now only in the code editor, yep

  • grogal Profile Picture
    grogal 6 on at
    Re: Dynamic adaptive cards with text inputs

    How can I create this node:'kind: Foreach'? Is it only available in code editor?

  • adilei Profile Picture
    adilei on at
    Re: Dynamic adaptive cards with text inputs

    Here is how to work with loops:

     

    kind: AdaptiveDialog
    beginDialog:
     kind: OnRecognizedIntent
     id: main
     intent:
     triggerQueries:
     - loop
     - repeat
     - run again
     - start over
     - do it again
     - try once more
     - give me another round
     - restart the loop
    
     actions:
     - kind: SetVariable
     id: setVariable_2oJevH
     variable: Topic.currItem
     value: "\"\""
    
     - kind: SetVariable
     id: setVariable_z9bKSl
     variable: Topic.items
     value: |-
     =[
     "item1","item2","item3"
     ]
    
     - kind: Foreach
     id: myForeach
     items: =Topic.items
     value: Topic.currItem
     actions:
     - kind: SendActivity
     id: sendActivity_5arpmt
     activity: "{Topic.currItem}"

Helpful resources

Quick Links

Exciting News for Copilot Studio Communi…

Get ready to experience a whole new level of engagement with the Copilot Studio…

Celebrating the May Super User of the…

LaurensM is an exceptional contributor to the Power Platform Community…

Check out the Copilot Studio Cookbook…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
renatoromao Profile Picture

renatoromao 6,459

#2
Pstork1 Profile Picture

Pstork1 1,997

#3
Expiscornovus Profile Picture

Expiscornovus 1,708

Leaderboard

Featured topics