Copilot in D365 Sales – View Prompts Custom Topic

kind: AdaptiveDialog
beginDialog:
  kind: OnEventActivity
  id: main
  priority: 10
  eventName: Microsoft.PowerApps.Copilot.RequestSparks
  actions:
    - kind: SetTextVariable
      id: 7ocqtY
      variable: Topic.CreateCase
      value: Create case

    - kind: SetTextVariable
      id: xoA7bJ
      variable: Topic.CreateRecords
      value: Create Records

    - kind: ParseValue
      id: kXCfz1
      variable: Topic.CreateRecordsSparks
      valueType:
        kind: Table

      value: [ ]

    - kind: SetVariable
      id: setVariable_ERhhQn
      variable: Topic.CreateRecordsSparks
      value: |-
        =[
          {
            displayName:""&Topic.CreateCase&" ",
            type:"PromptText",
            isEnabled: true
          }
        ]

    - kind: SetVariable
      id: setVariable_kaE01k
      variable: Topic.SparkGroups
      value: |-
        =Filter([
          {
            displayName:""&Topic.CreateRecords&"",
            displaySubtitle:""&Topic.CreateRecords&"",
            iconName:"ArrowForward24Regular",
            sparks: DropColumns(Filter(Topic.CreateRecordsSparks, isEnabled = true), isEnabled)
          }
        ], CountRows(sparks) > 0
        )

    - kind: ParseValue
      id: XcxspA
      variable: Topic.Sparks
      valueType:
        kind: Table
        properties:
          displayName: String
          displayTextForPrompt: String
          eventName: String
          iconName: String
          payload: String
          type: String

      value: [ ]

    - kind: SetVariable
      id: setVariable_9PFCUk
      variable: Global.PA_Copilot_Sparks.sparkGroups
      value: =ForAll(Sequence(CountRows(Global.PA_Copilot_Sparks.sparkGroups)+CountRows(Topic.SparkGroups)), If(Value<=CountRows(Global.PA_Copilot_Sparks.sparkGroups),Index (Global.PA_Copilot_Sparks.sparkGroups,Value), Index(Topic.SparkGroups, Value - CountRows(Global.PA_Copilot_Sparks.sparkGroups))))

    - kind: SetVariable
      id: setVariable_WrXJch
      variable: Global.PA_Copilot_Sparks.sparks
      value: =ForAll(Sequence(CountRows(Global.PA_Copilot_Sparks.sparks)+CountRows(Topic.Sparks)), If(Value<=CountRows(Global.PA_Copilot_Sparks.sparks),Index (Global.PA_Copilot_Sparks.sparks,Value), Index(Topic.Sparks, Value - CountRows(Global.PA_Copilot_Sparks.sparks))))
Share this!