Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Add Dependents

This scenario allows employees to add new dependents to their Workday profile for benefits enrollment purposes.

## Overview

The `AddDependents` topic allows employees to:
1. **View** their existing dependents
2. **Add** a new dependent (spouse, child, domestic partner, etc.)

## Flow

```
┌─────────────────────────────────────┐
│ User triggers topic │
└──────────────┬──────────────────────┘
┌─────────────────────────────────────┐
│ Fetch reference data │
│ (Relationship Types) │
└──────────────┬──────────────────────┘
┌─────────────────────────────────────┐
│ Fetch existing dependents │
│ (msdyn_HRWorkdayHCMEmployee │
│ GetDependents) │
└──────────────┬──────────────────────┘
┌──────┴──────┐
│ Dependents │
│ exist? │
└──────┬──────┘
┌───────┴───────┐
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ Show list of │ │ "No deps on │
│ existing │ │ file yet" │
│ dependents │ │ │
└──────┬───────┘ └──────┬───────┘
│ │
└───────┬────────┘
┌─────────────────────────────────────┐
│ Show Add Dependent Form │
│ (Adaptive Card) │
└──────────────┬──────────────────────┘
┌─────────────────────────────────────┐
│ Show Confirmation Card │
└──────────────┬──────────────────────┘
┌─────────────────────────────────────┐
│ Submit to Workday │
│ (msdyn_HRWorkdayHCMEmployee │
│ AddDependent) │
└──────────────┬──────────────────────┘
┌─────────────────────────────────────┐
│ Show success/error message │
└─────────────────────────────────────┘
```

## Files

| File | Purpose |
|------|---------|
| `AddDependents_Topic.yaml` | Main topic definition with full flow |
| `msdyn_GetDependents_Template.xml` | XML template for fetching existing dependents |
| `msdyn_AddDependent_Template.xml` | XML template for adding a new dependent |


## API Scenarios Used

| Scenario | API | Purpose |
|----------|-----|---------|
| `msdyn_HRWorkdayHCMEmployeeGetDependents` | Human_Resources v45.0 | Fetch existing dependents |
| `msdyn_HRWorkdayHCMEmployeeAddDependent` | Benefits_Administration v45.1 | Add new dependent |

## XPath Filtering

The Get Dependents template uses XPath predicates to filter only actual dependents (excluding emergency contacts):

```xpath
//*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]
```

This ensures that only `Related_Person` nodes containing a `Dependent` child element are returned.

## Form Fields

| Field | Type | Required | Source |
|-------|------|----------|--------|
| First Name | Text Input | Yes | User entry |
| Last Name | Text Input | Yes | User entry |
| Date of Birth | Date Input | Yes | User entry |
| Gender | Dropdown | Yes | Hardcoded (Male, Female, Not_Declared) |
| Relationship | Dropdown | Yes | Dynamic from `Global.RelatedPersonRelationshipLookupTable` |
| Country | Dropdown | Yes | Hardcoded (USA, CAN, GBR, AUS, DEU, FRA, IND) |

## Parameters

### Add Dependent Template Parameters

| Parameter | Description | Example |
|-----------|-------------|---------|
| `{Employee_ID}` | Employee's Workday ID | `21514` |
| `{First_Name}` | Dependent's first name | `John` |
| `{Last_Name}` | Dependent's last name | `Smith` |
| `{Date_Of_Birth}` | Date of birth (YYYY-MM-DD) | `2015-06-15` |
| `{Gender}` | Gender code | `Male` / `Female` / `Not_Declared` |
| `{Relationship_Type}` | Relationship type ID | `Biological_Child` |
| `{Country_Code}` | Country ISO code | `USA` |

### Get Dependents Template Parameters

| Parameter | Description | Example |
|-----------|-------------|---------|
| `{Employee_ID}` | Employee's Workday ID | `21514` |
| `{As_Of_Effective_Date}` | Effective date (YYYY-MM-DD) | `2025-12-30` |

## Response Data Extracted

### Get Dependents Response

| Key | XPath | Description |
|-----|-------|-------------|
| `DependentID` | `.//ID[@type='Dependent_ID']` | Unique dependent identifier |
| `DependentWID` | `.//ID[@type='WID']` (Dependent_Reference) | Workday Internal ID |
| `PersonWID` | `.//ID[@type='WID']` (Person_Reference) | Person reference WID |
| `FullName` | `.//Name_Detail_Data/@Formatted_Name` | Full formatted name |
| `FirstName` | `.//First_Name` | First name |
| `LastName` | `.//Last_Name` | Last name |
| `DateOfBirth` | `.//Dependent_Data/Date_of_Birth` | Date of birth |
| `Gender` | `.//Dependent_Data/Gender_Reference/@Descriptor` | Gender |
| `RelationshipTypeID` | `.//Related_Person_Relationship_ID` | Relationship type ID |
| `IsFullTimeStudent` | `.//Full_Time_Student` | Full-time student flag |
| `IsDisabled` | `.//Disabled` | Disabled flag |

### Add Dependent Response

| Key | XPath | Description |
|-----|-------|-------------|
| `DependentWID` | `.//Dependent_Reference/ID[@type='WID']` | Created dependent WID |
| `DependentID` | `.//Dependent_Reference/ID[@type='Dependent_ID']` | Created dependent ID |

## Example Triggers

- "Add a dependent"
- "I want to add my child as a dependent"
- "Add my spouse to my benefits"
- "Register a new dependent"
- "I need to add a family member"

## Dependencies

- `msdyn_copilotforemployeeselfservicehr.topic.GetReferenceData` - For fetching relationship types
- `msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution` - For API execution
- `Global.RelatedPersonRelationshipLookupTable` - Relationship types lookup
- `Global.ESS_UserContext_Employee_Id` - Current user's employee ID
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<workdayEntityConfigurationTemplate>
<scenario name="msdyn_HRWorkdayHCMEmployeeAddDependent">
<apiRequests>
<apiRequest>
<authType>User</authType>
<endpoint>
<request>Template_AddDependentRequest</request>
<serviceName>Benefits_Administration</serviceName>
<version>v45.1</version>
</endpoint>
<responseProperties>
<property>
<extractPath>//*[local-name()='Dependent_Reference']/*[local-name()='ID' and @*[local-name()='type']='WID']/text()</extractPath>
<key>DependentWID</key>
</property>
<property>
<extractPath>//*[local-name()='Dependent_Reference']/*[local-name()='ID' and @*[local-name()='type']='Dependent_ID']/text()</extractPath>
<key>DependentID</key>
</property>
</responseProperties>
</apiRequest>
</apiRequests>
</scenario>
<requestTemplates>
<requestTemplate name="Template_AddDependentRequest">
<bsvc:Add_Dependent_Request xmlns:bsvc="urn:com.workday/bsvc" bsvc:version="v45.1">
<bsvc:Business_Process_Parameters>
<bsvc:Auto_Complete>true</bsvc:Auto_Complete>
<bsvc:Run_Now>true</bsvc:Run_Now>
<bsvc:Discard_On_Exit_Validation_Error>true</bsvc:Discard_On_Exit_Validation_Error>
<bsvc:Comment_Data>
<bsvc:Comment>Dependent added via Copilot</bsvc:Comment>
<bsvc:Worker_Reference>
<bsvc:ID bsvc:type="Employee_ID">{Employee_ID}</bsvc:ID>
</bsvc:Worker_Reference>
</bsvc:Comment_Data>
</bsvc:Business_Process_Parameters>
<bsvc:Add_Dependent_Data>
<bsvc:Employee_Reference>
<bsvc:ID bsvc:type="Employee_ID">{Employee_ID}</bsvc:ID>
</bsvc:Employee_Reference>
<bsvc:Related_Person_Relationship_Reference>
<bsvc:ID bsvc:type="Related_Person_Relationship_ID">{Relationship_Type}</bsvc:ID>
</bsvc:Related_Person_Relationship_Reference>
<bsvc:Use_Employee_Address>true</bsvc:Use_Employee_Address>
<bsvc:Dependent_Personal_Information_Data>
<bsvc:Person_Name_Data>
<bsvc:Name_Detail_Data>
<bsvc:Country_Reference>
<bsvc:ID bsvc:type="ISO_3166-1_Alpha-3_Code">{Country_Code}</bsvc:ID>
</bsvc:Country_Reference>
<bsvc:First_Name>{First_Name}</bsvc:First_Name>
<bsvc:Last_Name>{Last_Name}</bsvc:Last_Name>
</bsvc:Name_Detail_Data>
</bsvc:Person_Name_Data>
<bsvc:Date_of_Birth>{Date_Of_Birth}</bsvc:Date_of_Birth>
<bsvc:Gender_Reference>
<bsvc:ID bsvc:type="Gender_Code">{Gender}</bsvc:ID>
</bsvc:Gender_Reference>
</bsvc:Dependent_Personal_Information_Data>
</bsvc:Add_Dependent_Data>
</bsvc:Add_Dependent_Request>
</requestTemplate>
</requestTemplates>
</workdayEntityConfigurationTemplate>
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<workdayEntityConfigurationTemplate>
<scenario name="msdyn_HRWorkdayHCMEmployeeGetDependents">
<apiRequests>
<apiRequest>
<authType>User</authType>
<endpoint>
<request>Template_GetDependentsRequest</request>
<serviceName>Human_Resources</serviceName>
<version>v42.0</version>
</endpoint>
<responseProperties>
<!-- ONLY extract data from Related_Person nodes that have a Dependent child -->
<!-- This ensures all arrays are aligned (only actual dependents) -->

<!-- Dependent ID -->
<property>
<extractPath>//*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]/*[local-name()='Dependent']/*[local-name()='Dependent_Reference']/*[local-name()='ID' and @*[local-name()='type']='Dependent_ID']/text()</extractPath>
<key>DependentID</key>
</property>
<!-- Dependent WID -->
<property>
<extractPath>//*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]/*[local-name()='Dependent']/*[local-name()='Dependent_Reference']/*[local-name()='ID' and @*[local-name()='type']='WID']/text()</extractPath>
<key>DependentWID</key>
</property>
<!-- Person WID (only for dependents) -->
<property>
<extractPath>//*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]/*[local-name()='Person_Reference']/*[local-name()='ID' and @*[local-name()='type']='WID']/text()</extractPath>
<key>PersonWID</key>
</property>
<!-- Full Name (only for dependents) -->
<property>
<extractPath>//*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]/*[local-name()='Personal_Data']/*[local-name()='Name_Data']/*[local-name()='Legal_Name_Data']/*[local-name()='Name_Detail_Data']/@*[local-name()='Formatted_Name']</extractPath>
<key>FullName</key>
</property>
<!-- First Name (only for dependents) -->
<property>
<extractPath>//*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]/*[local-name()='Personal_Data']/*[local-name()='Name_Data']/*[local-name()='Legal_Name_Data']/*[local-name()='Name_Detail_Data']/*[local-name()='First_Name']/text()</extractPath>
<key>FirstName</key>
</property>
<!-- Last Name (only for dependents) -->
<property>
<extractPath>//*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]/*[local-name()='Personal_Data']/*[local-name()='Name_Data']/*[local-name()='Legal_Name_Data']/*[local-name()='Name_Detail_Data']/*[local-name()='Last_Name']/text()</extractPath>
<key>LastName</key>
</property>
<!-- Date of Birth (only for dependents) -->
<property>
<extractPath>//*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]/*[local-name()='Personal_Data']/*[local-name()='Personal_Information_Data']/*[local-name()='Birth_Date']/text()</extractPath>
<key>DateOfBirth</key>
</property>
<!-- Gender (only for dependents) -->
<property>
<extractPath>//*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]/*[local-name()='Personal_Data']/*[local-name()='Personal_Information_Data']//*[local-name()='Gender_Reference']/*[local-name()='ID' and @*[local-name()='type']='Gender_Code']/text()</extractPath>
<key>Gender</key>
</property>
<!-- Relationship Type ID (only for dependents) -->
<property>
<extractPath>//*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]/*[local-name()='Related_Person_Relationship_Reference']/*[local-name()='ID' and @*[local-name()='type']='Related_Person_Relationship_ID']/text()</extractPath>
<key>RelationshipTypeID</key>
</property>
<!-- Full-time Student flag -->
<property>
<extractPath>//*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]/*[local-name()='Dependent']/*[local-name()='Dependent_Data']/*[local-name()='Full-time_Student']/text()</extractPath>
<key>IsFullTimeStudent</key>
</property>
<!-- Disabled flag -->
<property>
<extractPath>//*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]/*[local-name()='Dependent']/*[local-name()='Dependent_Data']/*[local-name()='Disabled']/text()</extractPath>
<key>IsDisabled</key>
</property>
</responseProperties>
</apiRequest>
</apiRequests>
</scenario>
<requestTemplates>
<requestTemplate name="Template_GetDependentsRequest">
<bsvc:Get_Workers_Request xmlns:bsvc="urn:com.workday/bsvc" bsvc:version="v42.0">
<bsvc:Request_References bsvc:Skip_Non_Existing_Instances="false" bsvc:Ignore_Invalid_References="true">
<bsvc:Worker_Reference bsvc:Descriptor="Employee_ID">
<bsvc:ID bsvc:type="Employee_ID">{Employee_ID}</bsvc:ID>
</bsvc:Worker_Reference>
</bsvc:Request_References>
<bsvc:Response_Filter>
<bsvc:As_Of_Effective_Date>{As_Of_Effective_Date}</bsvc:As_Of_Effective_Date>
</bsvc:Response_Filter>
<bsvc:Response_Group>
<bsvc:Include_Reference>true</bsvc:Include_Reference>
<bsvc:Include_Personal_Information>false</bsvc:Include_Personal_Information>
<bsvc:Include_Employment_Information>false</bsvc:Include_Employment_Information>
<bsvc:Include_Organizations>false</bsvc:Include_Organizations>
<bsvc:Include_Roles>false</bsvc:Include_Roles>
<bsvc:Include_Management_Chain_Data>false</bsvc:Include_Management_Chain_Data>
<bsvc:Include_Benefit_Enrollments>false</bsvc:Include_Benefit_Enrollments>
<bsvc:Include_Benefit_Eligibility>false</bsvc:Include_Benefit_Eligibility>
<bsvc:Include_Related_Persons>true</bsvc:Include_Related_Persons>
<bsvc:Include_Qualifications>false</bsvc:Include_Qualifications>
<bsvc:Include_Photo>false</bsvc:Include_Photo>
<bsvc:Include_Worker_Documents>false</bsvc:Include_Worker_Documents>
<bsvc:Include_Transaction_Log_Data>false</bsvc:Include_Transaction_Log_Data>
<bsvc:Include_User_Account>false</bsvc:Include_User_Account>
</bsvc:Response_Group>
</bsvc:Get_Workers_Request>
</requestTemplate>
</requestTemplates>
</workdayEntityConfigurationTemplate>
Loading