Skip to content

Commit 0665545

Browse files
Comprehensive task-based onboarding guide for WorkdayEmployeeRequestTimeOff (#496)
* Rewrite WorkdayEmployeeRequestTimeOff README as task-based onboarding guide * minor changes --------- Co-authored-by: Srikanth Deshpande <srideshpande@outlook.com>
1 parent 13a1f70 commit 0665545

3 files changed

Lines changed: 202 additions & 70 deletions

File tree

EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayEmployeeRequestTimeOff/README.md

Lines changed: 202 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -4,94 +4,226 @@ search_exclude: false
44
---
55
# Workday Employee Request Time Off
66

7-
## Overview
7+
This topic lets employees submit single-day or multi-day time off requests to Workday directly from a Copilot Studio agent.
88

9-
This topic enables employees to submit time off requests through a conversational interface with their Copilot Studio agent. Employees can request single-day or multi-day time off by specifying dates and selecting from available time off types (e.g., vacation, sick leave, personal time).
9+
When an employee triggers this topic, the agent:
1010

11-
## Features
11+
1. Fetches current leave balances from Workday
12+
2. Shows an Adaptive Card form with leave type, dates, hours, and reason
13+
3. Submits the request to the Workday `Enter_Time_Off` API
14+
4. Displays a confirmation card or a friendly error with retry options
1215

13-
- Request single-day or multi-day time off
14-
- Display available time off types dynamically from Workday
15-
- Validate date inputs for business logic compliance
16-
- Submit time off requests directly to Workday
17-
- Confirmation of successful submission
16+
**Example trigger phrases:** "Request time off" · "Request vacation from January 5th to January 10th" · "Submit sick leave for next week"
1817

19-
## Snapshots
18+
![Request Time Off form and adaptive card](requestTimeOffAdapativeCard.png)
19+
![Request Time Off form submitted](requestTimeOffSubmitted.png)
2020

21-
![Request Time Off](request_time_off.png)
21+
{: .important }
22+
> This topic ships with sample values from a reference Workday tenant. Every Workday tenant is configured differently — you must replace the Plan IDs, Reason IDs, leave types, and tenant URL with values from your own Workday setup before importing. See [Configure the topic](#configure-the-topic) for details.
2223
23-
## Trigger Phrases
24+
## Prerequisites
2425

25-
- "I want to request time off"
26-
- "Submit time off request"
27-
- "I need to take some time off"
28-
- "Request vacation"
29-
- "Book time off"
26+
Before you start, make sure you have:
3027

31-
## Files
28+
- The **msdyn_copilotforemployeeselfservicehr** managed solution installed in your agent
29+
- A Workday tenant with the **Absence_Management** module enabled
30+
- A Workday connector configured with **User**-level authentication in your Power Platform environment
31+
- The global variable **`Global.ESS_UserContext_Employee_Id`** populated at session start with the logged-in employee's Workday Employee ID
32+
- The **`msdyn_HRWorkdayHCMEmployeeGetVacationBalance`** template already imported (from the [EmployeeGetVacationBalance](../EmployeeGetVacationBalance/) folder)
33+
- Your organization's Workday Absence Plan IDs, Time Off Type IDs, and Reason IDs
3234

33-
| File | Description |
34-
|------|-------------|
35-
| `topic.yaml` | Copilot Studio topic definition with conversation flow |
36-
| `msdyn_HRWorkdayAbsenceEnterTimeOff_MultiDay.xml` | Workday API request template for multi-day time off |
35+
## What's in this folder
3736

38-
## Workday APIs Used
37+
| File | Description | Do you need to edit it? |
38+
|------|-------------|------------------------|
39+
| `topic.yaml` | Conversation flow, Adaptive Card form, configuration tables, error handling | Yes — update tenant URL, Plan IDs, Reason IDs |
40+
| `msdyn_HRWorkdayAbsenceEnterTimeOff_MultiDay.xml` | SOAP template for the Workday `Enter_Time_Off` API | Usually no |
41+
| `requestTimeOffAdapativeCard.png` | Screenshot of the Adaptive Card form | No |
42+
| `requestTimeOffSubmitted.png` | Screenshot of the confirmation card | No |
43+
| `README.md` | This file | No |
3944

40-
| API | Purpose |
41-
|-----|---------|
42-
| `Get_Time_Off_Types` | Retrieves available time off types for the employee |
43-
| `Enter_Time_Off` | Submits the time off request to Workday |
45+
## Import the templates
4446

45-
## Flow Overview
47+
Before configuring the topic, import the XML templates into your agent.
4648

49+
1. Add `msdyn_HRWorkdayAbsenceEnterTimeOff_MultiDay.xml` to your agent's ESS Template Configuration.
50+
51+
2. If you haven't already, import the balance template `msdyn_HRWorkdayHCMEmployeeGetVacationBalance` from the [EmployeeGetVacationBalance](../EmployeeGetVacationBalance/) folder. This topic calls it to display leave balances.
52+
53+
## Configure the topic
54+
55+
Open `topic.yaml` and update the following values to match your Workday tenant. All sample values shown below come from a reference tenant and **must** be replaced.
56+
57+
### Step 1: Set your Workday tenant URL
58+
59+
Find the `set_workday_url` node and replace `<TENANT_NAME>` with your tenant name:
60+
61+
```yaml
62+
# Before
63+
value: https://impl.workday.com/<TENANT_NAME>/home.htmld
64+
65+
# After — replace contoso_corp with your tenant
66+
value: https://impl.workday.com/contoso_corp/home.htmld
4767
```
48-
┌─────────────────────────────────────────────────────────────┐
49-
│ User Triggers Topic │
50-
└─────────────────────────────────────────────────────────────┘
51-
52-
53-
┌─────────────────────────────────────────────────────────────┐
54-
│ Collect Start Date from User │
55-
└─────────────────────────────────────────────────────────────┘
56-
57-
58-
┌─────────────────────────────────────────────────────────────┐
59-
│ Collect End Date from User │
60-
└─────────────────────────────────────────────────────────────┘
61-
62-
63-
┌─────────────────────────────────────────────────────────────┐
64-
│ Fetch Time Off Types via Workday Connector │
65-
└─────────────────────────────────────────────────────────────┘
66-
67-
68-
┌─────────────────────────────────────────────────────────────┐
69-
│ Display Time Off Types for Selection │
70-
└─────────────────────────────────────────────────────────────┘
71-
72-
73-
┌─────────────────────────────────────────────────────────────┐
74-
│ Submit Time Off Request to Workday │
75-
└─────────────────────────────────────────────────────────────┘
76-
77-
78-
┌─────────────────────────────────────────────────────────────┐
79-
│ Confirm Submission to User │
80-
└─────────────────────────────────────────────────────────────┘
68+
69+
Your Workday URL typically follows the pattern `https://<host>.workday.com/<tenant_name>/home.htmld`. Check your browser address bar when logged into Workday.
70+
71+
### Step 2: Update Plan IDs
72+
73+
Find the `set_plan_config` node. Replace each `PlanID` with the corresponding ID from your Workday tenant:
74+
8175
```
76+
=Table(
77+
{PlanID: "ABSENCE_PLAN-6-139", DisplayName: "Floating holiday"},
78+
{PlanID: "ABSENCE_PLAN-6-159", DisplayName: "Sick leave"},
79+
{PlanID: "ABSENCE_PLAN-6-158", DisplayName: "Vacation"}
80+
)
81+
```
82+
83+
You can find your Plan IDs in Workday under **Setup > Absence Plans > Plan ID**. Only plans listed here **and** returned by the Workday API will appear in the balance header.
84+
85+
### Step 3: Update Reason IDs
86+
87+
Find the **second** `set_time_off_reason_config` node. Replace each `ReasonID` with your tenant's value:
88+
89+
| ReasonKey | TimeOffTypeID | ReasonID ← replace this |
90+
|-----------|---------------|------------------------|
91+
| `full_day` | `ESS_Vacation_Hours` | `Full Day_Vac` |
92+
| `half_day_am` | `ESS_Vacation_Hours` | `Half Day_AM_Vac` |
93+
| `half_day_pm` | `ESS_Vacation_Hours` | `Half Day_PM_Vac` |
94+
| `full_day` | `ESS_Floating_Holiday_Hours` | `full_day_floating` |
95+
| `half_day_am` | `ESS_Floating_Holiday_Hours` | `half_day_am_floating` |
96+
| `half_day_pm` | `ESS_Floating_Holiday_Hours` | `half_day_pm_floating` |
97+
| `full_day` | `ESS_Comp_Off` | `Full day-COI` |
98+
| `half_day_am` | `ESS_Comp_Off` | `Half day AM-COI` |
99+
| `half_day_pm` | `ESS_Comp_Off` | `Half day PM-COI` |
100+
| `full_day` | `ESS_Sick_Time_Off` | `Full day_Sick_IN` |
101+
| `half_day_am` | `ESS_Sick_Time_Off` | `Half day AM_Sick_IN` |
102+
| `half_day_pm` | `ESS_Sick_Time_Off` | `Half day PM_Sick_IN` |
103+
104+
Don't rename the `ReasonKey` values — they're bound to the Adaptive Card "Reason for time off" dropdown.
105+
106+
### Step 4 (optional): Update leave-type choices
107+
108+
If your organization uses different leave types than Vacation, Floating holiday, Sick leave, and Comp off, update two places:
109+
110+
**The Adaptive Card dropdown** — in the `collect_time_off` node, edit the `choices` array. For example, to add Bereavement:
111+
112+
```json
113+
{ "title": "Bereavement", "value": "ESS_Bereavement" }
114+
```
115+
116+
**The keyword mapping** — in the `set_leave_type_config` node, add a row so the agent can pre-select the type from the user's utterance:
117+
118+
| Keywords (comma-separated) | LeaveTypeValue |
119+
|---------------------------|----------------|
120+
| `vacation,annual,pto,holiday pay` | `Vacation_Hours` |
121+
| `floating,floater,float day` | `Floating_Holiday_Hours` |
122+
| `sick,illness,medical,unwell,not feeling well` | `ESS_Sick_Time_Off` |
123+
124+
If you add a new leave type, also add matching rows to `TimeOffReasonConfig` (one per ReasonKey).
125+
126+
### Step 5 (optional): Update the Workday icon
127+
128+
Find the `set_workday_icon_url` node and replace the 1×1 pixel placeholder with your organization's Workday icon URL.
82129

83-
## Configurations
130+
## Import and test the topic
84131

85-
Environment makers need to configure the following in the topic:
132+
1. In Copilot Studio, go to **Topics > + Add a topic > From file**.
133+
2. Select `topic.yaml` and import.
134+
3. Open **Test your agent** and try these:
86135

87-
| Configuration | Description | Location in Topic |
88-
|---------------|-------------|-------------------|
89-
| **Time Off Plans** | Configure which time off plans to display balances for | Global variable or condition node |
90-
| **Time Off Types** | Define the available time off types for selection | Adaptive card or choice options |
91-
| **Workday Icon** | Update the icon URL to match your organization's branding | Topic properties > Icon |
92-
| **Workday URL** | Set your organization's Workday tenant URL | HTTP action or connector configuration |
136+
| What to test | What to expect |
137+
|-------------|---------------|
138+
| Say "I want to request time off" | Balance header appears, then the Adaptive Card form |
139+
| Say "Request vacation from September 15 to September 19" and submit | Success card with date range, type, hours, and reason |
140+
| Submit with end date before start date | Error: "The end date can't be earlier than the start date" with retry |
141+
| Select "I don't see my leave type listed" and submit | Redirect message with a link to Workday |
142+
| Click **Cancel** | "Leave request was cancelled - nothing was submitted" |
143+
| Submit dates that overlap an existing request | Friendly AI-rewritten error with retry |
144+
145+
If balances show as empty but the form appears, your `PlanConfig` Plan IDs likely don't match your Workday tenant.
146+
147+
## XML template reference
148+
149+
The `msdyn_HRWorkdayAbsenceEnterTimeOff_MultiDay.xml` file is a SOAP template for the Workday `Enter_Time_Off_Request` operation. You usually don't need to edit it — placeholder tokens like `{Employee_ID}` and `{timeoff_Dates}` are filled at runtime.
150+
151+
Two settings you might want to change:
152+
153+
| Setting | Default | Change if… |
154+
|---------|---------|------------|
155+
| `<wd:Auto_Complete>` | `false` (requires manager approval) | Your process skips approval — set to `true` |
156+
| `<version>` and `wd:version` | `v42.0` | Your tenant uses a different API version |
157+
158+
{: .important }
159+
> If you change the API version, update it in **both** the `<version>` element and the `wd:version` attribute. Mismatched versions cause API errors.
160+
161+
## What you can safely edit in the YAML
162+
163+
| What | Where in `topic.yaml` |
164+
|------|----------------------|
165+
| Workday tenant URL | `set_workday_url` node |
166+
| Plan IDs | `set_plan_config` node |
167+
| Reason IDs | Second `set_time_off_reason_config` node |
168+
| Leave-type keywords | `set_leave_type_config` node |
169+
| Adaptive Card dropdown choices | `collect_time_off` node → `choices` array |
170+
| Trigger phrases | `modelDescription` block |
171+
| Workday icon | `set_workday_icon_url` node |
172+
| Balance effective date | `set_as_of_effective_date` node (defaults to `Today()`) |
173+
174+
**Don't** change these — they'll break the topic:
175+
176+
- Node `id` values (`id: main`, `id: collect_time_off`, etc.) — referenced by `GotoAction` jumps
177+
- `kind:` values — Copilot Studio node types
178+
- `dialog:` references — point to the shared solution
179+
- `output: binding:` mappings — must match shared dialog outputs
180+
- XML placeholder tokens (`{Employee_ID}`, `{timeoff_Dates}`, etc.) — filled at runtime
181+
- The `EmployeeName` input — the model uses it to validate the request is for the logged-in user
93182

94183
## Dependencies
95184

96-
- **msdyn_HRWorkdayHCMEmployeeGetVacationBalance template**: Required for fetching available time off types
97-
- **Employee Context**: Worker ID must be available in the conversation context
185+
This topic depends on three external components:
186+
187+
- **Workday `Get_Time_Off_Plan_Balances`** — Absence_Management service, User-level auth. Uses the `msdyn_HRWorkdayHCMEmployeeGetVacationBalance` template from [EmployeeGetVacationBalance](../EmployeeGetVacationBalance/). Called at topic start to show balances.
188+
189+
- **Workday `Enter_Time_Off`** — Absence_Management v42.0, User-level auth. Uses the `msdyn_HRWorkdayAbsenceEnterTimeOff_MultiDay` template in this folder. Called after form submission.
190+
191+
- **`WorkdaySystemGetCommonExecution` dialog** — from the `msdyn_copilotforemployeeselfservicehr` solution. Executes XML templates against the Workday connector. Must be pre-installed.
192+
193+
## Troubleshooting
194+
195+
**Balance header is empty or shows all zeros**
196+
Your `PlanConfig` Plan IDs don't match your Workday tenant, or the balance template isn't imported. Verify the IDs and confirm `msdyn_HRWorkdayHCMEmployeeGetVacationBalance` is in your ESS Template Configuration.
197+
198+
**"Something went wrong" when submitting**
199+
The `ReasonID` values in `TimeOffReasonConfig` don't match your Workday tenant. Check your IDs in Workday under **Setup > Time Off Reasons**.
200+
201+
**Authentication error**
202+
`Global.ESS_UserContext_Employee_Id` is empty or the Workday connector isn't configured. Verify both.
203+
204+
**Vacation isn't pre-selected when the user says "request vacation"**
205+
The keyword mapping uses `Vacation_Hours` but the dropdown value is `ESS_Vacation_Hours`. Update `LeaveTypeConfig` to use `ESS_Vacation_Hours`. See [Open Questions](#open-questions).
206+
207+
**Success card shows a raw ID like `ESS_Vacation_Hours`**
208+
The `Switch()` expression in the success card doesn't match the dropdown values. See [Open Questions](#open-questions).
209+
210+
## Tips
211+
212+
- Import the balance template **before** this topic — the balance lookup runs at topic start and fails silently if the template is missing.
213+
- Update `PlanConfig`, `TimeOffReasonConfig`, **and** the Adaptive Card `choices` together — they're interconnected but maintained separately.
214+
- Test with a real Workday employee ID that has leave balances.
215+
- Keep `ReasonKey` values as `full_day`, `half_day_am`, `half_day_pm` — they're bound to the Adaptive Card dropdown.
216+
217+
## Handle repo updates
218+
219+
When this repo publishes a new version of the topic:
220+
221+
1. **Diff first.** Your customized tenant URL, Plan IDs, Reason IDs, and leave-type keywords will be overwritten if you re-import `topic.yaml`.
222+
2. **Merge.** Copy your config values from the current topic, pull the updated file, paste your values back, then import.
223+
3. The XML template is safe to overwrite — unless you changed `Auto_Complete` or the API version.
224+
225+
## Known limitations
226+
227+
- **Leave type pre-selection may not work for Vacation and Floating Holiday.** The keyword mapping (`LeaveTypeConfig`) uses `Vacation_Hours` and `Floating_Holiday_Hours`, but the Adaptive Card dropdown expects `ESS_Vacation_Hours` and `ESS_Floating_Holiday_Hours`. To fix this, update the `LeaveTypeValue` entries in `LeaveTypeConfig` to include the `ESS_` prefix.
228+
229+
- **Success card may show raw IDs instead of friendly names.** After a successful submission, the confirmation card may display `ESS_Vacation_Hours` instead of "Vacation". To work around this, update the `Switch()` expression in the success card to match the `ESS_`-prefixed values from the dropdown.
104 KB
Loading
113 KB
Loading

0 commit comments

Comments
 (0)