|
| 1 | +kind: AdaptiveDialog |
| 2 | +modelDescription: |- |
| 3 | + Shows the employee's open tasks from their Workday inbox. |
| 4 | + Available fields per task: task title (descriptor), due date, assigned date, step type, initiator (who submitted), overall process name. |
| 5 | +
|
| 6 | + Display rules: |
| 7 | + - Heading: "Your open tasks in Workday" |
| 8 | + - Show total count: "You have N open task(s)" |
| 9 | + - If total exceeds the shown count, note: "showing the most recent N" |
| 10 | + - List each task with: title, process, who it is from, step type, assigned date, due date |
| 11 | + - If no tasks: "Your Workday inbox is empty. No open tasks found." |
| 12 | + - Answer only for the requesting user's own tasks. Do not retrieve tasks for others. |
| 13 | +
|
| 14 | +beginDialog: |
| 15 | + kind: OnRecognizedIntent |
| 16 | + id: main |
| 17 | + intent: |
| 18 | + triggerQueries: |
| 19 | + - What tasks do I have in Workday? |
| 20 | + - Show my open tasks |
| 21 | + - What's in my Workday inbox? |
| 22 | + - Do I have any pending tasks? |
| 23 | + - What actions are waiting for me in Workday? |
| 24 | + - Show me my to-do list in Workday |
| 25 | + - My Workday tasks |
| 26 | + - Any tasks I need to complete? |
| 27 | + |
| 28 | + actions: |
| 29 | + - kind: SetVariable |
| 30 | + id: set_max_tasks |
| 31 | + displayName: Set max tasks to show |
| 32 | + variable: Topic.MaxTasks |
| 33 | + value: =20 |
| 34 | + |
| 35 | + - kind: BeginDialog |
| 36 | + id: get_inbox_tasks |
| 37 | + displayName: Get Workday inbox tasks |
| 38 | + input: |
| 39 | + binding: |
| 40 | + parameters: ="{""workerID"":""Employee_ID=" & Global.ESS_UserContext_Employee_Id & """,""limit"":" & Topic.MaxTasks & ",""offset"":0}" |
| 41 | + operationName: GetWorkerInboxTasks |
| 42 | + |
| 43 | + dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetRESTExecution |
| 44 | + output: |
| 45 | + binding: |
| 46 | + errorResponse: Topic.errorResponse |
| 47 | + isSuccess: Topic.isSuccess |
| 48 | + workdayResponse: Topic.workdayResponse |
| 49 | + |
| 50 | + - kind: ConditionGroup |
| 51 | + id: handle_result |
| 52 | + conditions: |
| 53 | + - id: success |
| 54 | + condition: =Topic.isSuccess = true |
| 55 | + actions: |
| 56 | + - kind: ParseValue |
| 57 | + id: parse_inbox |
| 58 | + displayName: Parse inbox tasks response |
| 59 | + variable: Topic.parsedInbox |
| 60 | + valueType: |
| 61 | + kind: Record |
| 62 | + properties: |
| 63 | + data: |
| 64 | + type: |
| 65 | + kind: Table |
| 66 | + properties: |
| 67 | + id: String |
| 68 | + descriptor: String |
| 69 | + due: String |
| 70 | + assigned: String |
| 71 | + stepType: |
| 72 | + type: |
| 73 | + kind: Record |
| 74 | + properties: |
| 75 | + descriptor: String |
| 76 | + initiator: |
| 77 | + type: |
| 78 | + kind: Record |
| 79 | + properties: |
| 80 | + descriptor: String |
| 81 | + overallProcess: |
| 82 | + type: |
| 83 | + kind: Record |
| 84 | + properties: |
| 85 | + descriptor: String |
| 86 | + total: |
| 87 | + type: Number |
| 88 | + |
| 89 | + value: =Topic.workdayResponse |
| 90 | + |
| 91 | + - kind: SetVariable |
| 92 | + id: set_shown_count |
| 93 | + variable: Topic.ShownCount |
| 94 | + value: =CountRows(Topic.parsedInbox.data) |
| 95 | + |
| 96 | + - kind: SetVariable |
| 97 | + id: set_total |
| 98 | + variable: Topic.TotalTasks |
| 99 | + value: =Coalesce(Topic.parsedInbox.total, Topic.ShownCount) |
| 100 | + |
| 101 | + - kind: ConditionGroup |
| 102 | + id: check_empty |
| 103 | + conditions: |
| 104 | + - id: has_tasks |
| 105 | + condition: =Topic.ShownCount > 0 |
| 106 | + actions: |
| 107 | + - kind: SendActivity |
| 108 | + id: show_tasks_card |
| 109 | + activity: |
| 110 | + attachments: |
| 111 | + - kind: AdaptiveCardTemplate |
| 112 | + cardContent: |- |
| 113 | + ={ |
| 114 | + type: "AdaptiveCard", |
| 115 | + '$schema': "http://adaptivecards.io/schemas/adaptive-card.json", |
| 116 | + version: "1.5", |
| 117 | + body: [ |
| 118 | + { |
| 119 | + type: "TextBlock", |
| 120 | + text: "Your open tasks in Workday", |
| 121 | + weight: "Bolder", |
| 122 | + size: "Medium", |
| 123 | + wrap: true |
| 124 | + }, |
| 125 | + { |
| 126 | + type: "TextBlock", |
| 127 | + text: "You have " & Topic.TotalTasks & " open task" & If(Topic.TotalTasks = 1, "", "s") & If(Topic.TotalTasks > Topic.ShownCount, ", showing the most recent " & Topic.ShownCount, ""), |
| 128 | + wrap: true, |
| 129 | + spacing: "Small", |
| 130 | + isSubtle: true |
| 131 | + }, |
| 132 | + { |
| 133 | + type: "Container", |
| 134 | + spacing: "Medium", |
| 135 | + items: ForAll( |
| 136 | + Topic.parsedInbox.data, |
| 137 | + { |
| 138 | + type: "Container", |
| 139 | + style: "emphasis", |
| 140 | + bleed: false, |
| 141 | + spacing: "Small", |
| 142 | + items: [ |
| 143 | + { |
| 144 | + type: "TextBlock", |
| 145 | + text: Coalesce(descriptor, "Untitled task"), |
| 146 | + weight: "Bolder", |
| 147 | + wrap: true |
| 148 | + }, |
| 149 | + { |
| 150 | + type: "FactSet", |
| 151 | + spacing: "Small", |
| 152 | + facts: [ |
| 153 | + { title: "Process", value: If(IsBlank(overallProcess.descriptor), "-", overallProcess.descriptor) }, |
| 154 | + { title: "From", value: If(IsBlank(initiator.descriptor), "-", initiator.descriptor) }, |
| 155 | + { title: "Type", value: If(IsBlank(stepType.descriptor), "-", stepType.descriptor) }, |
| 156 | + { title: "Assigned", value: If(IsBlank(assigned), "-", Left(assigned, 10)) }, |
| 157 | + { title: "Due", value: If(IsBlank(due), "-", Left(due, 10)) } |
| 158 | + ] |
| 159 | + } |
| 160 | + ] |
| 161 | + } |
| 162 | + ) |
| 163 | + } |
| 164 | + ], |
| 165 | + actions: [] |
| 166 | + } |
| 167 | +
|
| 168 | + - kind: CancelAllDialogs |
| 169 | + id: end_dialogs |
| 170 | + |
| 171 | + elseActions: |
| 172 | + - kind: SendActivity |
| 173 | + id: no_tasks |
| 174 | + activity: Your Workday inbox is empty. No open tasks found. Is there anything else I can help with? |
| 175 | + |
| 176 | + - kind: CancelAllDialogs |
| 177 | + id: end_no_tasks |
| 178 | + |
| 179 | + elseActions: |
| 180 | + - kind: SendActivity |
| 181 | + id: error_msg |
| 182 | + activity: I was not able to retrieve your tasks right now. Please try again or check your Workday inbox directly. |
| 183 | + |
| 184 | + - kind: CancelAllDialogs |
| 185 | + id: end_error |
| 186 | + |
| 187 | +inputType: {} |
| 188 | +outputType: {} |
0 commit comments