Skip to content

Commit 9a626d5

Browse files
nkemmsGoutham Surendra Ichapuram
andauthored
Add new WD REST scenarios (#503)
* Add Workday REST Topics * Update README.md --------- Co-authored-by: Goutham Surendra Ichapuram <isgoutham@hotmail.com>
1 parent f05241a commit 9a626d5

9 files changed

Lines changed: 1468 additions & 0 deletions

File tree

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
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: {}
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
kind: AdaptiveDialog
2+
modelDescription: |-
3+
Shows the employee's pay slip history from Workday.
4+
Available fields per pay slip: pay period name (descriptor), pay date, gross pay, net pay, status.
5+
6+
Display rules:
7+
- Heading: "Your pay slips"
8+
- Show count: "Here are your N most recent pay slips from Workday."
9+
- Each slip shows: pay period name, pay date, gross pay, net pay, status
10+
- If no pay slips found: "No pay slips were found in Workday."
11+
- Answer only if the user is asking about their own pay slips.
12+
13+
beginDialog:
14+
kind: OnRecognizedIntent
15+
id: main
16+
intent:
17+
triggerQueries:
18+
- Show my pay slips
19+
- View my pay stubs
20+
- Where can I find my payslip?
21+
- Show my pay history
22+
- I want to see my paycheck
23+
- Download my pay stub
24+
- What is my latest paycheck?
25+
- Show me my salary slips
26+
- Pay slips
27+
28+
actions:
29+
- kind: SetVariable
30+
id: set_max_slips
31+
displayName: Set max pay slips to fetch
32+
variable: Topic.MaxSlips
33+
value: =10
34+
35+
- kind: BeginDialog
36+
id: get_pay_slips
37+
displayName: Get pay slips
38+
input:
39+
binding:
40+
parameters: ="{""workerID"":""Employee_ID=" & Global.ESS_UserContext_Employee_Id & """,""limit"":" & Topic.MaxSlips & ",""offset"":0}"
41+
operationName: GetWorkerPaySlips
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_payslips
58+
displayName: Parse pay slips response
59+
variable: Topic.parsedPaySlips
60+
valueType:
61+
kind: Record
62+
properties:
63+
data:
64+
type:
65+
kind: Table
66+
properties:
67+
id: String
68+
descriptor: String
69+
date: String
70+
gross: Number
71+
net: Number
72+
status:
73+
type:
74+
kind: Record
75+
properties:
76+
descriptor: String
77+
total:
78+
type: Number
79+
80+
value: =Topic.workdayResponse
81+
82+
- kind: SetVariable
83+
id: set_count
84+
variable: Topic.slipCount
85+
value: =CountRows(Topic.parsedPaySlips.data)
86+
87+
- kind: ConditionGroup
88+
id: check_empty
89+
conditions:
90+
- id: has_slips
91+
condition: =Topic.slipCount > 0
92+
actions:
93+
- kind: SendActivity
94+
id: show_slips
95+
activity:
96+
attachments:
97+
- kind: AdaptiveCardTemplate
98+
cardContent: |-
99+
={
100+
type: "AdaptiveCard",
101+
'$schema': "http://adaptivecards.io/schemas/adaptive-card.json",
102+
version: "1.5",
103+
body: [
104+
{
105+
type: "TextBlock",
106+
text: "Your pay slips",
107+
weight: "Bolder",
108+
size: "Medium",
109+
wrap: true
110+
},
111+
{
112+
type: "TextBlock",
113+
text: "Here are your " & Topic.slipCount & " most recent pay slip" & If(Topic.slipCount = 1, "", "s") & " from Workday.",
114+
wrap: true,
115+
spacing: "Small",
116+
isSubtle: true
117+
},
118+
{
119+
type: "Container",
120+
spacing: "Medium",
121+
items: ForAll(
122+
Topic.parsedPaySlips.data,
123+
{
124+
type: "Container",
125+
style: "emphasis",
126+
bleed: false,
127+
spacing: "Small",
128+
items: [
129+
{
130+
type: "TextBlock",
131+
text: Coalesce(descriptor, "Pay slip"),
132+
weight: "Bolder",
133+
wrap: true
134+
},
135+
{
136+
type: "FactSet",
137+
spacing: "Small",
138+
facts: [
139+
{
140+
title: "Pay date",
141+
value: If(IsBlank(date), "-", Left(date, 10))
142+
},
143+
{
144+
title: "Gross pay",
145+
value: If(IsBlank(Text(gross)), "-", Text(gross, "#,##0.00"))
146+
},
147+
{
148+
title: "Net pay",
149+
value: If(IsBlank(Text(net)), "-", Text(net, "#,##0.00"))
150+
},
151+
{
152+
title: "Status",
153+
value: Coalesce(status.descriptor, "-")
154+
}
155+
]
156+
}
157+
]
158+
}
159+
)
160+
}
161+
],
162+
actions: []
163+
}
164+
165+
- kind: CancelAllDialogs
166+
id: end_dialogs
167+
168+
elseActions:
169+
- kind: SendActivity
170+
id: no_slips
171+
activity: No pay slips were found in Workday. If you recently started, pay slips may not be available yet.
172+
173+
- kind: CancelAllDialogs
174+
id: end_no_slips
175+
176+
elseActions:
177+
- kind: SendActivity
178+
id: error_msg
179+
activity: I was not able to retrieve your pay slips. Please try again or view them directly in Workday.
180+
181+
- kind: CancelAllDialogs
182+
id: end_error
183+
184+
inputType: {}
185+
outputType: {}

0 commit comments

Comments
 (0)