From c103c87d1291d9d242345e39c6360a4b698e8cfc Mon Sep 17 00:00:00 2001 From: Ankur Rana Date: Mon, 29 Dec 2025 14:08:40 +0530 Subject: [PATCH 1/7] Reverting changes added by AI --- .../WorkdayGetUserProfile/README.md | 164 ++++ ...dyn_HRWorkdayHCMEmployeeGetUserProfile.xml | 131 +++ .../WorkdayGetUserProfile/topic.yaml | 224 ++++++ .../WorkdayManageEmergencyContact/README.md | 152 ++++ ...RWorkdayHCMEmployeeAddEmergencyContact.xml | 101 +++ ...kdayHCMEmployeeGetEmergencyContactInfo.xml | 38 + ...rkdayHCMEmployeeUpdateEmergencyContact.xml | 105 +++ .../WorkdayManageEmergencyContact/topic.yaml | 745 ++++++++++++++++++ .../README.md | 106 +++ .../msdyn_GetManagerReportees.xml | 124 +++ .../topic.yaml | 174 ++++ 11 files changed, 2064 insertions(+) create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetUserProfile/README.md create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetUserProfile/msdyn_HRWorkdayHCMEmployeeGetUserProfile.xml create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetUserProfile/topic.yaml create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/README.md create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeAddEmergencyContact.xml create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeGetEmergencyContactInfo.xml create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeUpdateEmergencyContact.xml create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml create mode 100644 EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/README.md create mode 100644 EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/msdyn_GetManagerReportees.xml create mode 100644 EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/topic.yaml diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetUserProfile/README.md b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetUserProfile/README.md new file mode 100644 index 00000000..fddf25cc --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetUserProfile/README.md @@ -0,0 +1,164 @@ +# Workday Get User Profile + +This scenario enables employees to retrieve their profile information from Workday through a conversational interface. It provides comprehensive employee data including personal details, employment information, contact details, and tenure calculations. + +## Features + +- **Personal Information**: Name, Date of Birth, Gender +- **Employment Details**: Employee ID, Business Title, Organization/Department, Manager, Location +- **Contact Information**: Work Email, Work Phone, Home Email, Home Phone, Home Address +- **Employment Status**: Active/Inactive status, Hire Date +- **Tenure Calculation**: Continuous Service Date and calculated Length of Service (years, months, days) + +## Trigger Phrases + +Users can activate this topic with phrases like: +- "What is my profile?" +- "Show my profile" +- "What is my employee ID?" +- "What is my job title?" +- "What is my work email?" +- "Who is my manager?" +- "What department am I in?" +- "What is my tenure?" +- "How long have I been with the company?" +- "What is my hire date?" +- "Am I an active employee?" + +## Files + +| File | Description | +|------|-------------| +| `topic.yaml` | Main Copilot Studio topic definition | +| `msdyn_HRWorkdayHCMEmployeeGetUserProfile.xml` | XML template with XPath extractions for profile data | + +## Workday APIs Used + +| API | Service | Version | Purpose | +|-----|---------|---------|---------| +| `Get_Workers` | Human_Resources | v45.0 | Retrieve comprehensive employee profile data | + +## Data Retrieved + +The topic extracts the following fields from Workday: + +| Field | XPath Source | Description | +|-------|--------------|-------------| +| `EmployeeID` | Worker_Data/Worker_ID | Employee's Workday ID | +| `Name` | Worker_Descriptor | Employee's full name | +| `DOB` | Personal_Information_Data/Birth_Date | Date of birth | +| `Gender` | Gender_Reference/@Descriptor | Gender | +| `BusinessTitle` | Position_Data/Business_Title | Job title | +| `Organization` | Organization_Reference (SUPERVISORY_ORGANIZATION) | Department/Org | +| `Manager` | Manager_Reference/@Descriptor | Direct manager's name | +| `Location` | Location_Reference/@Descriptor | Work location | +| `HireDate` | Worker_Status_Data/Hire_Date | Original hire date | +| `WorkEmail` | Email_Address (WORK usage type) | Work email address | +| `HomeAddress` | Address_Data (HOME usage type) | Formatted home address | +| `HomeEmail` | Email_Address (HOME usage type, primary) | Personal email | +| `HomePhone` | Phone_Data (HOME usage type, primary) | Home phone number | +| `WorkPhone` | Phone_Data (WORK usage type, primary) | Work phone number | +| `Status` | Worker_Status_Data/Active | Employment status (Active/Inactive) | +| `ContinuousServiceDate` | Worker_Status_Data/Continuous_Service_Date | Service start date | +| `LengthOfService` | *Calculated* | Years, months, days of service | + +## Flow Overview + +``` +┌─────────────────────────────────────────────────────────────┐ +│ User Triggers Topic │ +│ (e.g., "What is my profile?") │ +└─────────────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────────────┐ +│ Call Get_Workers API │ +│ (with Employee_ID and As_Of_Date) │ +└─────────────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────────────┐ +│ Parse Response via XPath │ +│ (Extract all profile fields) │ +└─────────────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────────────┐ +│ Calculate Length of Service │ +│ (Years, Months, Days from Continuous Service Date) │ +└─────────────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────────────┐ +│ Return finalizedData Record │ +│ (All fields available for AI to respond) │ +└─────────────────────────────────────────────────────────────┘ +``` + +## Length of Service Calculation + +The topic automatically calculates the employee's length of service from their Continuous Service Date: + +``` +Years: RoundDown(DateDiff(ServiceDate, Today, Months) / 12, 0) +Months: Mod(DateDiff(ServiceDate, Today, Months), 12) +Days: DateDiff(AdjustedDate, Today, Days) +``` + +Output format: "X year(s) Y month(s) Z day(s)" + +## Dependencies + +This topic requires the following system topics/dialogs: +- `msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution` - For executing Workday API calls + +## Global Variables Used + +| Variable | Description | +|----------|-------------| +| `Global.ESS_UserContext_Employee_Id` | The logged-in employee's Workday Employee ID | + +## Output + +The topic outputs a `finalizedData` record containing all profile fields that can be used by the AI orchestrator to formulate responses based on what the user specifically asked for. + +```yaml +outputType: + properties: + finalizedData: + type: Record + properties: + EmployeeID: String + Name: String + DOB: String + Gender: String + BusinessTitle: String + Organization: String + Manager: String + Location: String + HireDate: String + WorkEmail: String + HomeAddress: String + HomeEmail: String + HomePhone: String + WorkPhone: String + Status: String + ContinuousServiceDate: String + LengthOfService: String +``` + +## Important Notes + +1. **Privacy**: This topic only returns data for the requesting user. Questions about other employees (managers, colleagues) are explicitly rejected per the model description. + +2. **Tenure Information**: Length of Service is only included in the AI's response when the user specifically asks about tenure, service length, or how long they've been with the company. + +3. **Status Conversion**: The raw `Active` field from Workday (1 or 0) is converted to human-readable "Active" or "Inactive". + +4. **Response Optimization**: The Get_Workers request is optimized to exclude unnecessary data (benefits, qualifications, photos, etc.) to improve performance. + +## Version History + +| Version | Date | Changes | +|---------|------|---------| +| 1.0 | December 2025 | Initial release with comprehensive profile retrieval | diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetUserProfile/msdyn_HRWorkdayHCMEmployeeGetUserProfile.xml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetUserProfile/msdyn_HRWorkdayHCMEmployeeGetUserProfile.xml new file mode 100644 index 00000000..37412e3d --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetUserProfile/msdyn_HRWorkdayHCMEmployeeGetUserProfile.xml @@ -0,0 +1,131 @@ + + + + + + User + + Template_GetWorkerRequest + Human_Resources + v45.0 + + + + //*[local-name()='Worker_Data']/*[local-name()='Worker_ID']/text() + EmployeeID + + + //*[local-name()='Get_Workers_Response']/*[local-name()='Response_Data']/*[local-name()='Worker'][1]/*[local-name()='Worker_Descriptor']/text() + Name + + + //*[local-name()='Personal_Information_Data']/*[local-name()='Birth_Date']/text() + DOB + + + //*[local-name()='Personal_Information_For_Country_Data']/*[local-name()='Country_Personal_Information_Data']/*[local-name()='Gender_Reference']/@*[local-name()='Descriptor'] + Gender + + + //*[local-name()='Position_Data']/*[local-name()='Business_Title']/text() + BusinessTitle + + + //*[local-name()='Worker_Organization_Data']/*[local-name()='Organization_Reference']/*[local-name()='ID'][@*[local-name()='type']='Organization_Reference_ID' and contains(text(),'SUPERVISORY_ORGANIZATION')]/../@*[local-name()='Descriptor'] + Organization + + + //*[local-name()='Worker_Supervisory_Management_Chain_Data']/*[local-name()='Management_Chain_Data']/*[local-name()='Manager_Reference']/@*[local-name()='Descriptor'] + Manager + + + //*[local-name()='Business_Site_Summary_Data']/*[local-name()='Location_Reference']/*[local-name()='ID'][@*[local-name()='type']='Location_ID']/../@*[local-name()='Descriptor'] + Location + + + //*[local-name()='Worker_Status_Data']/*[local-name()='Hire_Date']/text() + HireDate + + + //*[local-name()='Email_Address_Data'][*[local-name()='Usage_Data']/*[local-name()='Type_Data']/*[local-name()='Type_Reference']/*[local-name()='ID'][@*[local-name()='type']='Communication_Usage_Type_ID' and text()='WORK']]/*[local-name()='Email_Address']/text() + WorkEmail + + + //*[local-name()='Address_Data'][*[local-name()='Usage_Data']/*[local-name()='Type_Data']/*[local-name()='Type_Reference']/*[local-name()='ID'][@*[local-name()='type']='Communication_Usage_Type_ID' and text()='HOME']]/@*[local-name()='Formatted_Address'] + HomeAddress + + + //*[local-name()='Email_Address_Data'][*[local-name()='Usage_Data']/*[local-name()='Type_Data'][@*[local-name()='Primary']='1']/*[local-name()='Type_Reference']/*[local-name()='ID'][@*[local-name()='type']='Communication_Usage_Type_ID' and text()='HOME']]/*[local-name()='Email_Address']/text() + HomeEmail + + + //*[local-name()='Worker_Data']/*[local-name()='Personal_Data']/*[local-name()='Contact_Data']/*[local-name()='Phone_Data'][*[local-name()='Usage_Data']/*[local-name()='Type_Data'][@*[local-name()='Primary']='1']/*[local-name()='Type_Reference']/*[local-name()='ID'][@*[local-name()='type']='Communication_Usage_Type_ID' and text()='HOME']]/@*[local-name()='Tenant_Formatted_Phone'] + HomePhone + + + //*[local-name()='Worker_Data']/*[local-name()='Personal_Data']/*[local-name()='Contact_Data']/*[local-name()='Phone_Data'][*[local-name()='Usage_Data']/*[local-name()='Type_Data'][@*[local-name()='Primary']='1']/*[local-name()='Type_Reference']/*[local-name()='ID'][@*[local-name()='type']='Communication_Usage_Type_ID' and text()='WORK']]/@*[local-name()='Tenant_Formatted_Phone'] + WorkPhone + + + //*[local-name()='Worker_Status_Data']/*[local-name()='Active']/text() + Status + + + //*[local-name()='Worker_Status_Data']/*[local-name()='Continuous_Service_Date']/text() + ContinuousServiceDate + + + + + + + + + + + {Employee_ID} + + + + {As_Of_Effective_Date} + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + false + true + true + false + true + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetUserProfile/topic.yaml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetUserProfile/topic.yaml new file mode 100644 index 00000000..79909aea --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetUserProfile/topic.yaml @@ -0,0 +1,224 @@ +kind: AdaptiveDialog +modelDescription: |- + Respond to user's profile information requests from Workday. Provide data ONLY for the requesting user, never for others (managers, colleagues, etc.). + + Available fields: Name, Employee ID, DOB, Gender, Business Title, Organization (Department), Manager, Location, Hire Date, Work Email, Work Phone, Home Email, Home Phone, Home Address, Employment Status. + + Answer based on which specific data the user asks for. Include relevant fields based on the question. + + Include Continuous Service Date and Length of Service ONLY when user specifically asks about tenure, service length, years of service, or how long they've been with the company. + + Invalid requests: "What is my manager's job title?" "What is my colleague's employee ID?" "What department is John in?" + Valid requests: "What is my employee ID?" "What is my job title?" "Show my profile" "What is my work email?" "What is my tenure?" (include service length) + +beginDialog: + kind: OnRecognizedIntent + id: main + intent: + triggerQueries: + - What is my profile? + - Show my profile + - What is my employee ID? + - What is my job title? + - What is my work email? + - What is my manager's name? + - Who is my manager? + - What department am I in? + - What is my organization? + - What is my work phone number? + - What is my home address? + - What is my hire date? + - When did I start working here? + - What is my tenure? + - How long have I been with the company? + - What is my length of service? + - Am I an active employee? + - What is my employment status? + - What is my date of birth? + - What is my gender? + - What is my location? + - Where do I work? + + actions: + - kind: BeginDialog + id: dZAI4Y + displayName: Redirect to Workday Get Common Execution + input: + binding: + parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" + scenarioName: msdyn_HRWorkdayHCMEmployeeGetUserProfile + + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution + output: + binding: + errorResponse: Topic.errorResponse + isSuccess: Topic.isSuccess + workdayResponse: Topic.workdayResponse + + - kind: ParseValue + id: fP9fKn + displayName: Parse workdayResponse + variable: Topic.parsedWorkdayResponse + valueType: + kind: Record + properties: + EmployeeID: + type: + kind: Table + properties: + Value: String + Name: + type: + kind: Table + properties: + Value: String + DOB: + type: + kind: Table + properties: + Value: String + Gender: + type: + kind: Table + properties: + Value: String + BusinessTitle: + type: + kind: Table + properties: + Value: String + Organization: + type: + kind: Table + properties: + Value: String + Manager: + type: + kind: Table + properties: + Value: String + Location: + type: + kind: Table + properties: + Value: String + HireDate: + type: + kind: Table + properties: + Value: String + WorkEmail: + type: + kind: Table + properties: + Value: String + HomeAddress: + type: + kind: Table + properties: + Value: String + HomeEmail: + type: + kind: Table + properties: + Value: String + HomePhone: + type: + kind: Table + properties: + Value: String + WorkPhone: + type: + kind: Table + properties: + Value: String + Status: + type: + kind: Table + properties: + Value: String + ContinuousServiceDate: + type: + kind: Table + properties: + Value: String + + value: =Topic.workdayResponse + + - kind: SetVariable + id: setVariable_ServiceDate + displayName: Calculate service date values + variable: Topic.serviceDateCalc + value: =DateValue(First(Topic.parsedWorkdayResponse.ContinuousServiceDate).Value) + + - kind: SetVariable + id: setVariable_Years + displayName: Calculate years + variable: Topic.yearsOfService + value: =RoundDown(DateDiff(Topic.serviceDateCalc, Today(), TimeUnit.Months) / 12, 0) + + - kind: SetVariable + id: setVariable_Months + displayName: Calculate months + variable: Topic.monthsOfService + value: =Mod(DateDiff(Topic.serviceDateCalc, Today(), TimeUnit.Months), 12) + + - kind: SetVariable + id: setVariable_Days + displayName: Calculate days + variable: Topic.daysOfService + value: =DateDiff(DateAdd(Topic.serviceDateCalc, DateDiff(Topic.serviceDateCalc, Today(), TimeUnit.Months), TimeUnit.Months), Today(), TimeUnit.Days) + + - kind: SetVariable + id: setVariable_LHTcFu + displayName: Set finalized data + variable: Topic.finalizedData + value: |- + ={ + EmployeeID: First(Topic.parsedWorkdayResponse.EmployeeID).Value, + Name: First(Topic.parsedWorkdayResponse.Name).Value, + DOB: First(Topic.parsedWorkdayResponse.DOB).Value, + Gender: First(Topic.parsedWorkdayResponse.Gender).Value, + BusinessTitle: First(Topic.parsedWorkdayResponse.BusinessTitle).Value, + Organization: First(Topic.parsedWorkdayResponse.Organization).Value, + Manager: First(Topic.parsedWorkdayResponse.Manager).Value, + Location: First(Topic.parsedWorkdayResponse.Location).Value, + HireDate: First(Topic.parsedWorkdayResponse.HireDate).Value, + WorkEmail: First(Topic.parsedWorkdayResponse.WorkEmail).Value, + HomeAddress: First(Topic.parsedWorkdayResponse.HomeAddress).Value, + HomeEmail: First(Topic.parsedWorkdayResponse.HomeEmail).Value, + HomePhone: First(Topic.parsedWorkdayResponse.HomePhone).Value, + WorkPhone: First(Topic.parsedWorkdayResponse.WorkPhone).Value, + Status: If(First(Topic.parsedWorkdayResponse.Status).Value = "1", "Active", "Inactive"), + ContinuousServiceDate: First(Topic.parsedWorkdayResponse.ContinuousServiceDate).Value, + LengthOfService: + If(Topic.yearsOfService > 0, Topic.yearsOfService & " year" & If(Topic.yearsOfService > 1, "s", "") & " ", "") & + If(Topic.monthsOfService > 0, Topic.monthsOfService & " month" & If(Topic.monthsOfService > 1, "s", "") & " ", "") & + Topic.daysOfService & " day" & If(Topic.daysOfService <> 1, "s", "") + } + +inputType: {} +outputType: + properties: + finalizedData: + displayName: finalizedData + type: + kind: Record + properties: + EmployeeID: String + Name: String + DOB: String + Gender: String + BusinessTitle: String + Organization: String + Manager: String + Location: String + HireDate: String + WorkEmail: String + HomeAddress: String + HomeEmail: String + HomePhone: String + WorkPhone: String + Status: String + ContinuousServiceDate: String + LengthOfService: String diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/README.md b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/README.md new file mode 100644 index 00000000..f33b21ec --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/README.md @@ -0,0 +1,152 @@ +# Workday Manage Emergency Contact + +This scenario enables employees to manage their emergency contacts in Workday through a conversational interface. It supports both adding new emergency contacts and updating existing ones. + +## Features + +- **View Existing Contacts**: Displays a list of the employee's current emergency contacts with primary contact marked with ⭐ +- **Add New Contact**: Allows employees to add a new emergency contact +- **Update Existing Contact**: Allows employees to update details of an existing emergency contact +- **Primary Contact Management**: Set or change the primary emergency contact +- **Priority Assignment**: Assign priority levels (1-10) to contacts + +## Trigger Phrases + +Users can activate this topic with phrases like: +- "Manage my emergency contacts" +- "Update my emergency contact" +- "Add emergency contact" +- "Change my emergency contact information" +- "Edit my emergency contact details" +- "Who is my emergency contact?" +- "Show my emergency contacts" + +## Files + +| File | Description | +|------|-------------| +| `topic.yaml` | Main Copilot Studio topic definition with the conversational flow | +| `msdyn_HRWorkdayHCMEmployeeGetEmergencyContactInfo.xml` | XML template to fetch existing emergency contacts using Get_Workers API | +| `msdyn_HRWorkdayHCMEmployeeAddEmergencyContact.xml` | XML template to add a new emergency contact | +| `msdyn_HRWorkdayHCMEmployeeUpdateEmergencyContact.xml` | XML template to update an existing emergency contact | + +## Workday APIs Used + +| API | Service | Version | Purpose | +|-----|---------|---------|---------| +| `Get_Workers` | Human_Resources | v45.0 | Retrieve employee's existing emergency contacts | +| `Change_Emergency_Contacts` | Human_Resources | v45.0 | Add or update emergency contact information | + +## Data Collected + +The topic collects the following information for each emergency contact: + +### Required Fields +- **First Name** - Contact's first name +- **Last Name** - Contact's last name +- **Relationship** - Relationship to the employee (e.g., Spouse, Parent, Sibling) +- **Phone Country Code** - International dialing code +- **Phone Number** - Contact phone number +- **Phone Type** - Mobile, Home, or Work +- **Address Line 1** - Street address +- **City** - City name +- **State/Province** - State or province (supports USA, Canada, UK, India, Australia, Germany, France) +- **Postal Code** - ZIP or postal code +- **Country** - Country code + +### Optional Settings +- **Primary Contact** - Toggle to set as primary emergency contact +- **Priority** - Priority level (2-10, or 1 if primary) + +## Flow Overview + +``` +┌─────────────────────────────────────────────────────────────┐ +│ User Triggers Topic │ +└─────────────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────────────┐ +│ Fetch Reference Data (Country Codes, │ +│ Relationship Types) │ +└─────────────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────────────┐ +│ Fetch Existing Emergency Contacts │ +│ (Get_Workers API) │ +└─────────────────────────────────────────────────────────────┘ + │ + ▼ + ┌───────────────┴───────────────┐ + │ Has Existing Contacts? │ + └───────────────┬───────────────┘ + │ │ + Yes No + │ │ + ▼ ▼ + ┌───────────────────────┐ ┌─────────────────┐ + │ Show Selection Card │ │ Go to Add Mode │ + │ ⭐ Primary Contact │ │ │ + │ • Other Contacts │ │ │ + │ ➕ Add New Contact │ │ │ + └───────────────────────┘ └─────────────────┘ + │ │ + ▼ │ + ┌───────────────────────┐ │ + │ User Selects │ │ + │ Contact or Add New │ │ + └───────────────────────┘ │ + │ │ + ▼ ▼ +┌─────────────────────────────────────────────────────────────┐ +│ Show Add/Update Form │ +│ (Pre-filled if updating existing) │ +└─────────────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────────────┐ +│ Submit to Workday │ +│ (Change_Emergency_Contacts API) │ +└─────────────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────────────┐ +│ Display Success/Error Message │ +└─────────────────────────────────────────────────────────────┘ +``` + +## Dependencies + +This topic requires the following system topics/dialogs: +- `msdyn_copilotforemployeeselfservicehr.topic.GetReferenceData` - For fetching country codes and relationship types +- `msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution` - For executing Workday API calls + +## Global Variables Used + +| Variable | Description | +|----------|-------------| +| `Global.ESS_UserContext_Employee_Id` | The logged-in employee's Workday Employee ID | +| `Global.CountryCodeLookupTable` | Cached country phone codes | +| `Global.RelatedPersonRelationshipLookupTable` | Cached relationship types | + +## Important Notes + +1. **Replace_All Setting**: The XML templates use `false` to ensure that adding or updating a contact does not delete other existing contacts. + +2. **Primary Contact Priority**: When a contact is set as primary, their priority is automatically set to 1. + +3. **Contact Selection**: Existing contacts are sorted with the primary contact at the top (marked with ⭐), followed by other contacts sorted by priority. + +## Error Handling + +The topic includes error handling for: +- Failed API calls to Workday +- User cancellation at any step +- Validation errors on required fields + +## Version History + +| Version | Date | Changes | +|---------|------|---------| +| 1.0 | December 2025 | Initial release with Add/Update functionality | diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeAddEmergencyContact.xml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeAddEmergencyContact.xml new file mode 100644 index 00000000..10d5e1b2 --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeAddEmergencyContact.xml @@ -0,0 +1,101 @@ + + + + + User + + Template_AddEmergencyContactRequest + Human_Resources + v45.0 + + + + //*[local-name()='Emergency_Contact_Event_Reference']/*[local-name()='ID'][@*[local-name()='type']='WID']/text() + EventID + + + + + + + + + + true + true + true + + {Comment} + + {Employee_ID} + + + + + + {Employee_ID} + + false + + false + + {Primary} + {Priority} + + {Relationship_Type} + + + + + + + {Country_Code} + + {First_Name} + {Last_Name} + + + + + + + {Address_Country_Code} + + {Address_Line_1} + {City} + + {State_Province} + + {Postal_Code} + + + + HOME + + + + + + {Address_Country_Code} + {Phone_Country_Code} + {Phone_Number} + + {Phone_Device_Type} + + + + + HOME + + + + + + + + + + + + + diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeGetEmergencyContactInfo.xml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeGetEmergencyContactInfo.xml new file mode 100644 index 00000000..42b00aab --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeGetEmergencyContactInfo.xml @@ -0,0 +1,38 @@ + + + + + + User + + Template_GetEmergencyContactInfoRequest + Human_Resources + v45.0 + + + + //*[local-name()='Related_Person_Data']//*[local-name()='Related_Person'] + EmergencyContacts + + + + + + + + + + + {Employee_ID} + + + + {As_Of_Effective_Date} + + + true + + + + + diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeUpdateEmergencyContact.xml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeUpdateEmergencyContact.xml new file mode 100644 index 00000000..d35d012a --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeUpdateEmergencyContact.xml @@ -0,0 +1,105 @@ + + + + + + User + + Template_UpdateEmergencyContactRequest + Human_Resources + v45.0 + + + + //*[local-name()='Emergency_Contact_Event_Reference']/*[local-name()='ID'][@*[local-name()='type']='WID']/text() + EventID + + + + + + + + + + true + true + true + + {Comment} + + {Employee_ID} + + + + + + {Employee_ID} + + false + + + {Emergency_Contact_WID} + + false + + {Primary} + {Priority} + + {Relationship_Type} + + + + + + + {Country_Code} + + {First_Name} + {Last_Name} + + + + + + + {Address_Country_Code} + + {Address_Line_1} + {City} + + {State_Province} + + {Postal_Code} + + + + HOME + + + + + + {Address_Country_Code} + {Phone_Country_Code} + {Phone_Number} + + {Phone_Device_Type} + + + + + HOME + + + + + + + + + + + + + \ No newline at end of file diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml new file mode 100644 index 00000000..4fac298d --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml @@ -0,0 +1,745 @@ +kind: AdaptiveDialog +modelDescription: |- + You will respond to requests related to managing emergency contacts for the user making the request. + This includes adding new emergency contacts or updating existing ones. + All emergency contact operations are submitted to Workday (Human_Resources) and pertain exclusively to the requesting user. + This data exclusively belongs to the user making the request. Do not respond to questions about other people's data. + + Example invalid requests: + "Manage emergency contact for my manager" + "Update emergency contact for my colleague" + + Example valid requests: + "Manage my emergency contacts" + "Update my emergency contact" + "Add or update emergency contact" + "Change my emergency contact information" +beginDialog: + kind: OnRecognizedIntent + id: main + intent: {} + actions: + - kind: ConditionGroup + id: check_country_codes + conditions: + - id: country_codes_uninitialized + condition: =IsBlank(Global.CountryCodeLookupTable) + displayName: If country code picklist is uninitialized + actions: + - kind: BeginDialog + id: fetch_country_codes + displayName: Redirect to Workday System Get Reference Data + input: + binding: + referenceDataKey: Country_Phone_Code_ID + + dialog: msdyn_copilotforemployeeselfservice.topic.GetReferenceData + + - kind: ConditionGroup + id: check_relationship_types + conditions: + - id: relationship_types_uninitialized + condition: =IsBlank(Global.RelatedPersonRelationshipLookupTable) + displayName: If relationship type picklist is uninitialized + actions: + - kind: BeginDialog + id: fetch_relationship_types + displayName: Redirect to Workday System Get Reference Data + input: + binding: + referenceDataKey: Related_Person_Relationship_ID + + dialog: msdyn_copilotforemployeeselfservice.topic.GetReferenceData + + - kind: BeginDialog + id: fetch_emergency_contacts + displayName: Fetch existing emergency contacts + input: + binding: + parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" + scenarioName: msdyn_HRWorkdayHCMEmployeeGetEmergencyContactInfo + + dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + output: + binding: + errorResponse: Topic.fetchErrorResponse + isSuccess: Topic.fetchIsSuccess + workdayResponse: Topic.existingContactsResponse + + - kind: ParseValue + id: parse_contacts + displayName: Parse emergency contacts response + variable: Topic.parsedContacts + valueType: + kind: Record + properties: + EmergencyContacts: + type: + kind: Table + properties: + Emergency_Contact: + type: + kind: Record + properties: + Emergency_Contact_Data: + type: + kind: Record + properties: + @Primary: String + @Priority: String + Emergency_Contact_ID: String + + Emergency_Contact_Reference: + type: + kind: Record + properties: + @Descriptor: String + ID: + type: + kind: Table + properties: + @type: String + "#text": String + + Person_Reference: + type: + kind: Record + properties: + @Descriptor: String + + Personal_Data: + type: + kind: Record + properties: + Contact_Data: + type: + kind: Record + properties: + Address_Data: + type: + kind: Table + properties: + @Formatted_Address: String + Address_Line_Data: + type: + kind: Record + properties: + "#text": String + + Country_Reference: + type: + kind: Record + properties: + ID: + type: + kind: Table + properties: + @type: String + "#text": String + + Country_Region_Reference: + type: + kind: Record + properties: + ID: + type: + kind: Table + properties: + @type: String + "#text": String + + Municipality: String + Postal_Code: String + + Phone_Data: + type: + kind: Record + properties: + @Tenant_Formatted_Phone: String + International_Phone_Code: String + Phone_Number: String + + Name_Data: + type: + kind: Record + properties: + Legal_Name_Data: + type: + kind: Record + properties: + Name_Detail_Data: + type: + kind: Record + properties: + @Formatted_Name: String + First_Name: String + Last_Name: String + + Related_Person_Relationship_Reference: + type: + kind: Table + properties: + @Descriptor: String + ID: + type: + kind: Table + properties: + @type: String + "#text": String + + value: =Topic.existingContactsResponse + + - kind: SetVariable + id: set_contact_list + displayName: Transform contacts for display + variable: Topic.contactSelectionList + value: | + =ForAll( + Topic.parsedContacts.EmergencyContacts, + { + DisplayName: ThisRecord.Personal_Data.Name_Data.Legal_Name_Data.Name_Detail_Data.'@Formatted_Name', + FirstName: ThisRecord.Personal_Data.Name_Data.Legal_Name_Data.Name_Detail_Data.First_Name, + LastName: ThisRecord.Personal_Data.Name_Data.Legal_Name_Data.Name_Detail_Data.Last_Name, + Phone: ThisRecord.Personal_Data.Contact_Data.Phone_Data.'@Tenant_Formatted_Phone', + PhoneNumber: ThisRecord.Personal_Data.Contact_Data.Phone_Data.Phone_Number, + PhoneCountryCode: ThisRecord.Personal_Data.Contact_Data.Phone_Data.International_Phone_Code, + Address: First(ThisRecord.Personal_Data.Contact_Data.Address_Data).'@Formatted_Address', + AddressLine1: First(ThisRecord.Personal_Data.Contact_Data.Address_Data).Address_Line_Data.'#text', + City: First(ThisRecord.Personal_Data.Contact_Data.Address_Data).Municipality, + PostalCode: First(ThisRecord.Personal_Data.Contact_Data.Address_Data).Postal_Code, + StateProvince: LookUp(First(ThisRecord.Personal_Data.Contact_Data.Address_Data).Country_Region_Reference.ID, '@type' = "Country_Region_ID").'#text', + CountryCode: LookUp(First(ThisRecord.Personal_Data.Contact_Data.Address_Data).Country_Reference.ID, '@type' = "ISO_3166-1_Alpha-3_Code").'#text', + RelationshipType: First(ThisRecord.Related_Person_Relationship_Reference).'@Descriptor', + RelationshipTypeID: LookUp(First(ThisRecord.Related_Person_Relationship_Reference).ID, '@type' = "Related_Person_Relationship_ID").'#text', + IsPrimary: ThisRecord.Emergency_Contact.Emergency_Contact_Data.'@Primary', + Priority: ThisRecord.Emergency_Contact.Emergency_Contact_Data.'@Priority', + WID: LookUp(ThisRecord.Emergency_Contact.Emergency_Contact_Reference.ID, '@type' = "WID").'#text' + } + ) + + - kind: ConditionGroup + id: check_contacts_exist + conditions: + - id: has_existing_contacts + condition: =CountRows(Topic.contactSelectionList) > 0 + displayName: If user has existing emergency contacts + actions: + - kind: SetVariable + id: build_selection_choices + displayName: Build selection choices with Add New option + variable: Topic.selectionChoices + value: | + =Table( + ForAll( + SortByColumns(Topic.contactSelectionList, "IsPrimary", SortOrder.Descending, "Priority", SortOrder.Ascending), + { + title: If(ThisRecord.IsPrimary = "1" || ThisRecord.IsPrimary = "true", "⭐ ", "") & ThisRecord.DisplayName & " (" & ThisRecord.RelationshipType & ") - " & Coalesce(ThisRecord.Phone, "No phone"), + value: ThisRecord.WID + } + ), + { title: "➕ Add New Emergency Contact", value: "ADD_NEW" } + ) + + - kind: AdaptiveCardPrompt + id: select_contact_card + displayName: Select emergency contact to update + card: |- + ={ + type: "AdaptiveCard", + '$schema': "http://adaptivecards.io/schemas/adaptive-card.json", + version: "1.3", + body: [ + { + type: "TextBlock", + text: "Manage Emergency Contacts", + weight: "Bolder", + size: "Medium", + wrap: true, + color: "Accent" + }, + { + type: "TextBlock", + text: "You have " & CountRows(Topic.contactSelectionList) & " emergency contact(s). Select one to update or add a new contact.", + wrap: true + }, + { + type: "Input.ChoiceSet", + id: "selectedContact", + label: "Select Emergency Contact", + style: "expanded", + isRequired: true, + errorMessage: "Please select an option.", + choices: ForAll(Topic.selectionChoices, { title: ThisRecord.title, value: ThisRecord.value }) + } + ], + actions: [ + { type: "Action.Submit", title: "Continue" }, + { type: "Action.Submit", title: "Cancel", associatedInputs: "none" } + ] + } + output: + binding: + actionSubmitId: Topic.selectionActionId + selectedContact: Topic.selectedContactWID + + outputType: + properties: + actionSubmitId: String + selectedContact: String + + - kind: ConditionGroup + id: handle_selection_cancel + conditions: + - id: selection_cancelled + condition: =Topic.selectionActionId = "Cancel" + actions: + - kind: SendActivity + id: selection_cancel_msg + activity: Your request has been cancelled. Is there anything else you need help with? + + - kind: CancelAllDialogs + id: selection_cancel_all + + - kind: ConditionGroup + id: set_mode + conditions: + - id: is_update_mode + condition: =Topic.selectedContactWID <> "ADD_NEW" + displayName: Update existing contact + actions: + - kind: SetVariable + id: set_update_mode + variable: Topic.isUpdateMode + value: =true + + - kind: SetVariable + id: set_selected_contact_data + variable: Topic.selectedContactData + value: =LookUp(Topic.contactSelectionList, WID = Topic.selectedContactWID) + + elseActions: + - kind: SetVariable + id: set_add_mode + variable: Topic.isUpdateMode + value: =false + + elseActions: + - kind: SetVariable + id: set_add_mode_no_contacts + variable: Topic.isUpdateMode + value: =false + + - kind: SendActivity + id: no_contacts_msg + activity: You don't have any emergency contacts configured yet. Let's add one now. + + - kind: AdaptiveCardPrompt + id: emergency_contact_form + displayName: Emergency contact form + card: |- + ={ + type: "AdaptiveCard", + '$schema': "http://adaptivecards.io/schemas/adaptive-card.json", + version: "1.3", + body: [ + { + type: "TextBlock", + text: If(Topic.isUpdateMode, "Update Emergency Contact", "Add Emergency Contact"), + weight: "Bolder", + size: "Medium", + wrap: true, + color: "Accent" + }, + { + type: "TextBlock", + text: If(Topic.isUpdateMode, "Update the details for " & Topic.selectedContactData.DisplayName & ".", "Please provide the details for your emergency contact."), + wrap: true + }, + { + type: "Input.Text", + id: "firstName", + label: "First Name", + placeholder: "Enter first name", + isRequired: true, + errorMessage: "First name is required.", + maxLength: 100, + value: If(Topic.isUpdateMode, Topic.selectedContactData.FirstName, "") + }, + { + type: "Input.Text", + id: "lastName", + label: "Last Name", + placeholder: "Enter last name", + isRequired: true, + errorMessage: "Last name is required.", + maxLength: 100, + value: If(Topic.isUpdateMode, Topic.selectedContactData.LastName, "") + }, + { + type: "Input.Toggle", + id: "isPrimaryContact", + title: "Set as Primary Emergency Contact", + value: If(Topic.isUpdateMode, If(Topic.selectedContactData.IsPrimary = "true" || Topic.selectedContactData.IsPrimary = "1", "true", "false"), "false"), + valueOn: "true", + valueOff: "false" + }, + { + type: "Input.ChoiceSet", + id: "priority", + label: "Priority (only applies if not primary)", + style: "compact", + isRequired: true, + errorMessage: "Please select a priority.", + choices: [ + { title: "2 - High", value: "2" }, + { title: "3", value: "3" }, + { title: "4", value: "4" }, + { title: "5 - Medium", value: "5" }, + { title: "6", value: "6" }, + { title: "7", value: "7" }, + { title: "8", value: "8" }, + { title: "9", value: "9" }, + { title: "10 - Low", value: "10" } + ], + value: If(Topic.isUpdateMode, If(Value(Topic.selectedContactData.Priority) > 1, Topic.selectedContactData.Priority, "2"), "2") + }, + { + type: "Input.ChoiceSet", + id: "relationshipType", + label: "Relationship", + style: "compact", + isRequired: true, + errorMessage: "Please select a relationship type.", + choices: ForAll(Global.RelatedPersonRelationshipLookupTable, { title: ThisRecord.Referenced_Object_Descriptor, value: ThisRecord.ID }), + value: If(Topic.isUpdateMode, Topic.selectedContactData.RelationshipTypeID, First(Global.RelatedPersonRelationshipLookupTable).ID) + }, + { + type: "Input.ChoiceSet", + id: "phoneCountryCode", + label: "Phone Country Code", + style: "compact", + isRequired: true, + errorMessage: "Please select a country code.", + choices: ForAll(Global.CountryCodeLookupTable, { title: ThisRecord.Referenced_Object_Descriptor, value: ThisRecord.ID }), + value: If(Topic.isUpdateMode, LookUp(Global.CountryCodeLookupTable, Last(Split(ID, "_")).Value = Topic.selectedContactData.PhoneCountryCode).ID, First(Global.CountryCodeLookupTable).ID) + }, + { + type: "Input.Text", + id: "phoneNumber", + label: "Phone Number", + placeholder: "Enter phone number (without country code)", + isRequired: true, + errorMessage: "Phone number is required.", + maxLength: 20, + value: If(Topic.isUpdateMode, Topic.selectedContactData.PhoneNumber, "") + }, + { + type: "Input.ChoiceSet", + id: "phoneDeviceType", + label: "Phone Type", + style: "compact", + isRequired: true, + errorMessage: "Please select a phone type.", + choices: [ + { title: "Mobile", value: "Mobile" }, + { title: "Home", value: "Home" }, + { title: "Work", value: "Work" } + ], + value: "Mobile" + }, + { + type: "Input.Text", + id: "addressLine1", + label: "Address Line 1", + placeholder: "Enter street address", + isRequired: true, + errorMessage: "Address is required.", + maxLength: 200, + value: If(Topic.isUpdateMode, Topic.selectedContactData.AddressLine1, "") + }, + { + type: "Input.Text", + id: "city", + label: "City", + placeholder: "Enter city", + isRequired: true, + errorMessage: "City is required.", + maxLength: 100, + value: If(Topic.isUpdateMode, Topic.selectedContactData.City, "") + }, + { + type: "Input.ChoiceSet", + id: "stateProvince", + label: "State/Province", + style: "compact", + isRequired: true, + errorMessage: "Please select a state/province.", + choices: [ + { title: "-- USA --", value: "_USA_HEADER" }, + { title: "Alabama", value: "USA-AL" }, + { title: "Alaska", value: "USA-AK" }, + { title: "Arizona", value: "USA-AZ" }, + { title: "Arkansas", value: "USA-AR" }, + { title: "California", value: "USA-CA" }, + { title: "Colorado", value: "USA-CO" }, + { title: "Connecticut", value: "USA-CT" }, + { title: "Delaware", value: "USA-DE" }, + { title: "Florida", value: "USA-FL" }, + { title: "Georgia", value: "USA-GA" }, + { title: "Hawaii", value: "USA-HI" }, + { title: "Idaho", value: "USA-ID" }, + { title: "Illinois", value: "USA-IL" }, + { title: "Indiana", value: "USA-IN" }, + { title: "Iowa", value: "USA-IA" }, + { title: "Kansas", value: "USA-KS" }, + { title: "Kentucky", value: "USA-KY" }, + { title: "Louisiana", value: "USA-LA" }, + { title: "Maine", value: "USA-ME" }, + { title: "Maryland", value: "USA-MD" }, + { title: "Massachusetts", value: "USA-MA" }, + { title: "Michigan", value: "USA-MI" }, + { title: "Minnesota", value: "USA-MN" }, + { title: "Mississippi", value: "USA-MS" }, + { title: "Missouri", value: "USA-MO" }, + { title: "Montana", value: "USA-MT" }, + { title: "Nebraska", value: "USA-NE" }, + { title: "Nevada", value: "USA-NV" }, + { title: "New Hampshire", value: "USA-NH" }, + { title: "New Jersey", value: "USA-NJ" }, + { title: "New Mexico", value: "USA-NM" }, + { title: "New York", value: "USA-NY" }, + { title: "North Carolina", value: "USA-NC" }, + { title: "North Dakota", value: "USA-ND" }, + { title: "Ohio", value: "USA-OH" }, + { title: "Oklahoma", value: "USA-OK" }, + { title: "Oregon", value: "USA-OR" }, + { title: "Pennsylvania", value: "USA-PA" }, + { title: "Rhode Island", value: "USA-RI" }, + { title: "South Carolina", value: "USA-SC" }, + { title: "South Dakota", value: "USA-SD" }, + { title: "Tennessee", value: "USA-TN" }, + { title: "Texas", value: "USA-TX" }, + { title: "Utah", value: "USA-UT" }, + { title: "Vermont", value: "USA-VT" }, + { title: "Virginia", value: "USA-VA" }, + { title: "Washington", value: "USA-WA" }, + { title: "West Virginia", value: "USA-WV" }, + { title: "Wisconsin", value: "USA-WI" }, + { title: "Wyoming", value: "USA-WY" }, + { title: "District of Columbia", value: "USA-DC" }, + { title: "-- Canada --", value: "_CAN_HEADER" }, + { title: "Alberta", value: "CAN-AB" }, + { title: "British Columbia", value: "CAN-BC" }, + { title: "Manitoba", value: "CAN-MB" }, + { title: "New Brunswick", value: "CAN-NB" }, + { title: "Newfoundland and Labrador", value: "CAN-NL" }, + { title: "Nova Scotia", value: "CAN-NS" }, + { title: "Ontario", value: "CAN-ON" }, + { title: "Prince Edward Island", value: "CAN-PE" }, + { title: "Quebec", value: "CAN-QC" }, + { title: "Saskatchewan", value: "CAN-SK" }, + { title: "-- United Kingdom --", value: "_GBR_HEADER" }, + { title: "England", value: "GBR-ENG" }, + { title: "Scotland", value: "GBR-SCT" }, + { title: "Wales", value: "GBR-WLS" }, + { title: "Northern Ireland", value: "GBR-NIR" }, + { title: "-- India --", value: "_IND_HEADER" }, + { title: "Andhra Pradesh", value: "IND-AP" }, + { title: "Delhi", value: "IND-DL" }, + { title: "Gujarat", value: "IND-GJ" }, + { title: "Haryana", value: "IND-HR" }, + { title: "Karnataka", value: "IND-KA" }, + { title: "Kerala", value: "IND-KL" }, + { title: "Madhya Pradesh", value: "IND-MP" }, + { title: "Maharashtra", value: "IND-MH" }, + { title: "Punjab", value: "IND-PB" }, + { title: "Rajasthan", value: "IND-RJ" }, + { title: "Tamil Nadu", value: "IND-TN" }, + { title: "Telangana", value: "IND-TG" }, + { title: "Uttar Pradesh", value: "IND-UP" }, + { title: "West Bengal", value: "IND-WB" }, + { title: "-- Australia --", value: "_AUS_HEADER" }, + { title: "Australian Capital Territory", value: "AUS-ACT" }, + { title: "New South Wales", value: "AUS-NSW" }, + { title: "Northern Territory", value: "AUS-NT" }, + { title: "Queensland", value: "AUS-QLD" }, + { title: "South Australia", value: "AUS-SA" }, + { title: "Tasmania", value: "AUS-TAS" }, + { title: "Victoria", value: "AUS-VIC" }, + { title: "Western Australia", value: "AUS-WA" }, + { title: "-- Germany --", value: "_DEU_HEADER" }, + { title: "Bavaria", value: "DEU-BY" }, + { title: "Berlin", value: "DEU-BE" }, + { title: "Hamburg", value: "DEU-HH" }, + { title: "Hesse", value: "DEU-HE" }, + { title: "North Rhine-Westphalia", value: "DEU-NW" }, + { title: "-- France --", value: "_FRA_HEADER" }, + { title: "Île-de-France", value: "FRA-IDF" }, + { title: "Provence-Alpes-Côte d'Azur", value: "FRA-PAC" }, + { title: "Auvergne-Rhône-Alpes", value: "FRA-ARA" } + ], + value: If(Topic.isUpdateMode, Topic.selectedContactData.StateProvince, "USA-WA") + }, + { + type: "Input.Text", + id: "postalCode", + label: "Postal Code", + placeholder: "Enter postal code", + isRequired: true, + errorMessage: "Postal code is required.", + maxLength: 20, + value: If(Topic.isUpdateMode, Topic.selectedContactData.PostalCode, "") + }, + { + type: "Input.ChoiceSet", + id: "countryCode", + label: "Country", + style: "compact", + isRequired: true, + errorMessage: "Please select a country.", + choices: [ + { title: "United States", value: "USA" }, + { title: "Canada", value: "CAN" }, + { title: "United Kingdom", value: "GBR" }, + { title: "India", value: "IND" }, + { title: "Australia", value: "AUS" }, + { title: "Germany", value: "DEU" }, + { title: "France", value: "FRA" }, + { title: "Japan", value: "JPN" }, + { title: "China", value: "CHN" }, + { title: "Brazil", value: "BRA" }, + { title: "Mexico", value: "MEX" }, + { title: "Italy", value: "ITA" }, + { title: "Spain", value: "ESP" }, + { title: "Netherlands", value: "NLD" }, + { title: "Singapore", value: "SGP" }, + { title: "Ireland", value: "IRL" }, + { title: "Israel", value: "ISR" }, + { title: "South Korea", value: "KOR" }, + { title: "Switzerland", value: "CHE" }, + { title: "Sweden", value: "SWE" } + ], + value: If(Topic.isUpdateMode, Topic.selectedContactData.CountryCode, "USA") + } + ], + actions: [ + { type: "Action.Submit", title: If(Topic.isUpdateMode, "Update", "Submit") }, + { type: "Action.Submit", title: "Cancel", associatedInputs: "none" } + ] + } + output: + binding: + actionSubmitId: Topic.formActionId + addressLine1: Topic.addressLine1 + city: Topic.city + countryCode: Topic.countryCode + firstName: Topic.firstName + isPrimaryContact: Topic.isPrimaryContact + lastName: Topic.lastName + phoneCountryCode: Topic.phoneCountryCode + phoneDeviceType: Topic.phoneDeviceType + phoneNumber: Topic.phoneNumber + postalCode: Topic.postalCode + priority: Topic.priority + relationshipType: Topic.relationshipType + stateProvince: Topic.stateProvince + + outputType: + properties: + actionSubmitId: String + addressLine1: String + city: String + countryCode: String + firstName: String + isPrimaryContact: String + lastName: String + phoneCountryCode: String + phoneDeviceType: String + phoneNumber: String + postalCode: String + priority: String + relationshipType: String + stateProvince: String + + - kind: ConditionGroup + id: handle_form_cancel + conditions: + - id: form_cancelled + condition: =Topic.formActionId = "Cancel" + actions: + - kind: SendActivity + id: form_cancel_msg + activity: Your request has been cancelled. Is there anything else you need help with? + + - kind: CancelAllDialogs + id: form_cancel_all + + - kind: ConditionGroup + id: submit_to_workday + conditions: + - id: is_update_submit + condition: =Topic.isUpdateMode = true + displayName: Submit update to Workday + actions: + - kind: BeginDialog + id: execute_update + displayName: Execute Workday Update + input: + binding: + parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{Emergency_Contact_WID}"",""value"":""" & Topic.selectedContactWID & """},{""key"":""{Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""},{""key"":""{First_Name}"",""value"":""" & Topic.firstName & """},{""key"":""{Last_Name}"",""value"":""" & Topic.lastName & """},{""key"":""{Primary}"",""value"":""" & Topic.isPrimaryContact & """},{""key"":""{Priority}"",""value"":""" & If(Topic.isPrimaryContact = "true", "1", Topic.priority) & """},{""key"":""{Relationship_Type}"",""value"":""" & Topic.relationshipType & """},{""key"":""{Phone_Number}"",""value"":""" & Topic.phoneNumber & """},{""key"":""{Phone_Device_Type}"",""value"":""" & Topic.phoneDeviceType & """},{""key"":""{Phone_Country_Code}"",""value"":""" & Last(Split(Topic.phoneCountryCode, "_")).Value & """},{""key"":""{Address_Line_1}"",""value"":""" & Topic.addressLine1 & """},{""key"":""{City}"",""value"":""" & Topic.city & """},{""key"":""{State_Province}"",""value"":""" & Topic.stateProvince & """},{""key"":""{Postal_Code}"",""value"":""" & Topic.postalCode & """},{""key"":""{Country_Code}"",""value"":""" & Topic.countryCode & """},{""key"":""{Address_Country_Code}"",""value"":""" & Topic.countryCode & """},{""key"":""{Comment}"",""value"":""Updating emergency contact""}]}" + scenarioName: msdyn_UpdateEmergencyContact + + dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + output: + binding: + errorResponse: Topic.errorResponse + isSuccess: Topic.isSuccess + workdayResponse: Topic.workdayResponse + + elseActions: + - kind: BeginDialog + id: execute_add + displayName: Execute Workday Add + input: + binding: + parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""},{""key"":""{First_Name}"",""value"":""" & Topic.firstName & """},{""key"":""{Last_Name}"",""value"":""" & Topic.lastName & """},{""key"":""{Primary}"",""value"":""" & Topic.isPrimaryContact & """},{""key"":""{Priority}"",""value"":""" & If(Topic.isPrimaryContact = "true", "1", Topic.priority) & """},{""key"":""{Relationship_Type}"",""value"":""" & Topic.relationshipType & """},{""key"":""{Phone_Number}"",""value"":""" & Topic.phoneNumber & """},{""key"":""{Phone_Device_Type}"",""value"":""" & Topic.phoneDeviceType & """},{""key"":""{Phone_Country_Code}"",""value"":""" & Last(Split(Topic.phoneCountryCode, "_")).Value & """},{""key"":""{Address_Line_1}"",""value"":""" & Topic.addressLine1 & """},{""key"":""{City}"",""value"":""" & Topic.city & """},{""key"":""{State_Province}"",""value"":""" & Topic.stateProvince & """},{""key"":""{Postal_Code}"",""value"":""" & Topic.postalCode & """},{""key"":""{Country_Code}"",""value"":""" & Topic.countryCode & """},{""key"":""{Address_Country_Code}"",""value"":""" & Topic.countryCode & """},{""key"":""{Comment}"",""value"":""Adding emergency contact""}]}" + scenarioName: msdyn_AddEmergencyContact + + dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + output: + binding: + errorResponse: Topic.errorResponse + isSuccess: Topic.isSuccess + workdayResponse: Topic.workdayResponse + + - kind: ConditionGroup + id: report_result + conditions: + - id: failed + condition: =Topic.isSuccess = false + actions: + - kind: SendActivity + id: failure_msg + activity: ={If(Topic.isUpdateMode, "An error occurred and your emergency contact was not updated.", "An error occurred and your emergency contact was not added.") & " Please try again or contact support."} + + elseActions: + - kind: ConditionGroup + id: success_message_condition + conditions: + - id: update_success + condition: =Topic.isUpdateMode = true + actions: + - kind: SendActivity + id: update_success_msg + activity: Your emergency contact has been successfully updated in Workday. + + elseActions: + - kind: SendActivity + id: add_success_msg + activity: Your emergency contact has been successfully added to Workday. + + - kind: CancelAllDialogs + id: end_dialogs + +inputType: {} +outputType: {} \ No newline at end of file diff --git a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/README.md b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/README.md new file mode 100644 index 00000000..227a00c5 --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/README.md @@ -0,0 +1,106 @@ +# Workday Get Manager Reportees Time In Position + +## Overview +This scenario enables managers to view their direct reports along with how long each employee has been in their current position. It retrieves team member information from Workday HCM and calculates the time in position for each reportee. + +## Files + +| File | Description | +|------|-------------| +| `topic.yaml` | Copilot Studio topic definition with trigger phrases and Power Fx logic | +| `msdyn_GetManagerReportees.xml` | XML template for Workday Get_Workers API call | + +## Prerequisites + +### Global Variables Required +- `Global.ESS_UserContext_ManagerOrganizationId` - The manager's organization ID in Workday (used to filter direct reports) + +### Workday API +- **Service**: Human_Resources +- **Operation**: Get_Workers +- **Version**: v42.0 + +## Scenario Details + +### What It Does +1. Retrieves all employees in the manager's organization (direct reports) +2. Extracts key employee information (Name, Title, Position Start Date, etc.) +3. Calculates Time in Position for each employee using Power Fx DateDiff functions +4. Presents results with tenure information formatted as "X years, Y months, Z days" + +### Data Retrieved +| Field | Description | +|-------|-------------| +| EmployeeID | Workday Employee ID | +| Name | Employee's legal formatted name | +| BusinessTitle | Current job title | +| WorkerType | Employee or Contingent Worker | +| JobProfile | Job profile name | +| Location | Business site/location name | +| PositionStartDate | Date employee started current position | +| HireDate | Original hire date | +| Status | Active/Inactive status | +| TimeInPositionYears | Calculated years in current position | +| TimeInPositionMonths | Calculated remaining months | +| TimeInPositionDays | Calculated remaining days | +| TimeInPosition | Formatted string (e.g., "2 years, 3 months, 15 days") | + +### Trigger Phrases +- "Show me my team's time in position" +- "How long have my direct reports been in their roles" +- "Get reportees time in current position" +- "List my team members with their position tenure" +- "Who on my team has been in their role the longest" +- "Show tenure for my direct reports" +- "My reportees job tenure" +- "Time in position for my team" + +## Time In Position Calculation + +The scenario uses Power Fx formulas to calculate time in position: + +``` +TimeInPositionYears = Int(DateDiff(DateValue(PositionStartDate), Now(), TimeUnit.Months) / 12) +TimeInPositionMonths = Mod(DateDiff(DateValue(PositionStartDate), Now(), TimeUnit.Months), 12) +TimeInPositionDays = DateDiff(DateAdd(DateAdd(DateValue(PositionStartDate), Years, TimeUnit.Years), Months, TimeUnit.Months), Now(), TimeUnit.Days) +``` + +## Response Group Configuration + +The XML template is optimized for performance by: +- **Including**: Reference, Personal Information, Employment Information +- **Excluding**: Compensation, Benefits, Documents, Photos, and other unnecessary data +- **Filtering**: Only active workers (`Exclude_Inactive_Workers: true`) + +## Setup Instructions + +1. **Import the Topic**: Import `topic.yaml` into your Copilot Studio agent +2. **Add XML Template**: Upload `msdyn_GetManagerReportees.xml` to your Workday connector configuration +3. **Configure Connection**: Ensure your Workday connector connection reference is properly set in the topic +4. **Set Global Variable**: Make sure `Global.ESS_UserContext_ManagerOrganizationId` is populated (typically from user authentication context) + +## Model Instructions + +The topic includes model instructions for the AI to: +- Display results as a nested markdown list +- Format Time in Position clearly +- Show Name, Job Title, Time in Position, Start Date, and Status for each reportee +- Sort or group results based on user's question context + +## Example Output + +When a manager asks "Show me my team's time in position", the agent displays: + +``` +Here are your direct reports and their time in current position: + +- **John Smith** - Senior Developer + - Time in Position: 2 years, 5 months, 12 days + - Position Start: 2022-07-15 + - Status: Active + +- **Jane Doe** - Product Manager + - Time in Position: 1 year, 2 months, 3 days + - Position Start: 2023-10-20 + - Status: Active +``` diff --git a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/msdyn_GetManagerReportees.xml b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/msdyn_GetManagerReportees.xml new file mode 100644 index 00000000..72a67a03 --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/msdyn_GetManagerReportees.xml @@ -0,0 +1,124 @@ + + + + + User + + Template_GetManagerReporteesRequest + Human_Resources + v42.0 + + + + //*[local-name()='Worker_Data']/*[local-name()='Worker_ID']/text() + EmployeeID + + + //*[local-name()='Worker_Descriptor']/text() + Name + + + //*[local-name()='Worker_Data']/*[local-name()='Employment_Data']/*[local-name()='Worker_Job_Data']/*[local-name()='Position_Data']/*[local-name()='Business_Title']/text() + BusinessTitle + + + //*[local-name()='Worker_Data']/*[local-name()='Employment_Data']/*[local-name()='Worker_Job_Data']/*[local-name()='Position_Data']/*[local-name()='Worker_Type_Reference']/@*[local-name()='Descriptor'] + WorkerType + + + //*[local-name()='Worker_Data']/*[local-name()='Employment_Data']/*[local-name()='Worker_Job_Data']/*[local-name()='Position_Data']/*[local-name()='Job_Profile_Summary_Data']/*[local-name()='Job_Profile_Reference']/@*[local-name()='Descriptor'] + JobProfile + + + //*[local-name()='Worker_Data']/*[local-name()='Employment_Data']/*[local-name()='Worker_Job_Data']/*[local-name()='Position_Data']/*[local-name()='Business_Site_Summary_Data']/*[local-name()='Location_Reference']/@*[local-name()='Descriptor'] + Location + + + //*[local-name()='Worker_Data']/*[local-name()='Employment_Data']/*[local-name()='Worker_Job_Data']/*[local-name()='Position_Data']/*[local-name()='Start_Date']/text() + PositionStartDate + + + //*[local-name()='Worker_Data']/*[local-name()='Employment_Data']/*[local-name()='Worker_Status_Data']/*[local-name()='Hire_Date']/text() + HireDate + + + //*[local-name()='Worker_Data']/*[local-name()='Employment_Data']/*[local-name()='Worker_Status_Data']/*[local-name()='Active']/text() + Status + + + + + + + + + + + {Manager_Org_ID} + + + + true + false + false + false + true + false + false + true + true + true + true + true + true + true + true + true + true + true + true + true + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + true + true + true + true + true + true + true + true + true + true + + + + + \ No newline at end of file diff --git a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/topic.yaml b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/topic.yaml new file mode 100644 index 00000000..d88188e2 --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/topic.yaml @@ -0,0 +1,174 @@ +kind: AdaptiveDialog +modelDescription: |- + You will respond to requests about time in position for direct reports of the user making the request. There is no information available for anyone who isn't a direct report, and being a direct report means that the individual is not a manager, spouse, sibling, or any other relationship to the requestor, and only means that they report to the requestor. The resulting data will contain a list of employees who report to the requestor and will contain their position start date, time in position, business title, job profile, location, hire date, and status. You must NOT give data if you do not have enough info. + + + Example valid request: + "What is the time in position of my direct reports?" + "Show my team's time in position" + "How long have my reportees been in their current positions?" + + Your output **must** be a nested list in markdown language based on the data contained in the {Topic.workdayResponseTableWithTimeInPosition} variable +beginDialog: + kind: OnRecognizedIntent + id: main + intent: {} + actions: + - kind: BeginDialog + id: jJpz3n + displayName: Redirect to Workday Get Common Execution + input: + binding: + parameters: ="{""params"":[{""key"":""{Manager_Org_ID}"",""value"":""" & Global.ESS_UserContext_ManagerOrganizationId & """}]}" + scenarioName: msdyn_GetManagerReportees + + dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + output: + binding: + errorResponse: Topic.errorResponse + isSuccess: Topic.isSuccess + workdayResponse: Topic.workdayResponse + + - kind: ParseValue + id: aXVFNu + displayName: Parse value to a record + variable: Topic.workdayResponseRecord + valueType: + kind: Record + properties: + BusinessTitle: + type: + kind: Table + properties: + Value: String + + EmployeeID: + type: + kind: Table + properties: + Value: String + + HireDate: + type: + kind: Table + properties: + Value: String + + JobProfile: + type: + kind: Table + properties: + Value: String + + Location: + type: + kind: Table + properties: + Value: String + + Name: + type: + kind: Table + properties: + Value: String + + PositionStartDate: + type: + kind: Table + properties: + Value: String + + Status: + type: + kind: Table + properties: + Value: String + + WorkerType: + type: + kind: Table + properties: + Value: String + + value: =Topic.workdayResponse + + - kind: SetVariable + id: setVariable_ztXmui + displayName: Extract data to table + variable: Topic.workdayResponseTable + value: |- + =ForAll( + Sequence(CountRows(Topic.workdayResponseRecord.EmployeeID)), + { + EmployeeID: Last(FirstN(Topic.workdayResponseRecord.EmployeeID, Value)).Value, + Name: Last(FirstN(Topic.workdayResponseRecord.Name, Value)).Value, + BusinessTitle: Last(FirstN(Topic.workdayResponseRecord.BusinessTitle, Value)).Value, + WorkerType: Last(FirstN(Topic.workdayResponseRecord.WorkerType, Value)).Value, + JobProfile: Last(FirstN(Topic.workdayResponseRecord.JobProfile, Value)).Value, + Location: Last(FirstN(Topic.workdayResponseRecord.Location, Value)).Value, + PositionStartDate: Last(FirstN(Topic.workdayResponseRecord.PositionStartDate, Value)).Value, + HireDate: Last(FirstN(Topic.workdayResponseRecord.HireDate, Value)).Value, + Status: If(Last(FirstN(Topic.workdayResponseRecord.Status, Value)).Value = "1", "Active", "Inactive") + } + ) + + - kind: SetVariable + id: setVariable_AddTimeInPosition + displayName: Add Time in Position calculations + variable: Topic.workdayResponseTableWithTimeInPosition + value: |- + =ForAll( + Topic.workdayResponseTable, + With( + { + positionDate: DateValue(PositionStartDate), + yearsCalc: RoundDown(DateDiff(DateValue(PositionStartDate), Today(), TimeUnit.Months) / 12, 0), + monthsCalc: Mod(DateDiff(DateValue(PositionStartDate), Today(), TimeUnit.Months), 12), + daysCalc: DateDiff( + DateAdd(DateValue(PositionStartDate), DateDiff(DateValue(PositionStartDate), Today(), TimeUnit.Months), TimeUnit.Months), + Today(), + TimeUnit.Days + ) + }, + { + EmployeeID: EmployeeID, + Name: Name, + BusinessTitle: BusinessTitle, + WorkerType: WorkerType, + JobProfile: JobProfile, + Location: Location, + PositionStartDate: PositionStartDate, + HireDate: HireDate, + Status: Status, + TimeInPositionYears: yearsCalc, + TimeInPositionMonths: monthsCalc, + TimeInPositionDays: daysCalc, + TimeInPosition: + If(yearsCalc > 0, yearsCalc & " year" & If(yearsCalc > 1, "s", "") & " ", "") & + If(monthsCalc > 0, monthsCalc & " month" & If(monthsCalc > 1, "s", "") & " ", "") & + daysCalc & " day" & If(daysCalc <> 1, "s", "") + } + ) + ) + +inputType: {} +outputType: + properties: + workdayResponseTableWithTimeInPosition: + displayName: workdayResponseTableWithTimeInPosition + type: + kind: Table + properties: + BusinessTitle: String + EmployeeID: String + HireDate: String + JobProfile: String + Location: String + Name: String + PositionStartDate: String + Status: String + TimeInPosition: String + TimeInPositionDays: Number + TimeInPositionMonths: Number + TimeInPositionYears: Number + WorkerType: String \ No newline at end of file From 45b396049f610d43c481a9bc2103f73112ec4f2f Mon Sep 17 00:00:00 2001 From: Ankur Rana Date: Mon, 29 Dec 2025 14:50:40 +0530 Subject: [PATCH 2/7] Fixing schema name for phase 1 open source topics --- .../WorkdayManageEmergencyContact/topic.yaml | 10 +++++----- .../topic.yaml | 2 +- .../WorkdayManagerServiceAnniversary/topic.yaml | 4 ++-- .../WorkdayManagersdirect-CompanyCode/topic.yaml | 4 ++-- .../WorkdayManagersdirect-CostCenter/topic.yaml | 4 ++-- .../WorkdayManagersdirect-Jobtaxanomy/topic.yaml | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml index 4fac298d..a84cf83c 100644 --- a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml @@ -33,7 +33,7 @@ beginDialog: binding: referenceDataKey: Country_Phone_Code_ID - dialog: msdyn_copilotforemployeeselfservice.topic.GetReferenceData + dialog: msdyn_copilotforemployeeselfservicehr.topic.GetReferenceData - kind: ConditionGroup id: check_relationship_types @@ -49,7 +49,7 @@ beginDialog: binding: referenceDataKey: Related_Person_Relationship_ID - dialog: msdyn_copilotforemployeeselfservice.topic.GetReferenceData + dialog: msdyn_copilotforemployeeselfservicehr.topic.GetReferenceData - kind: BeginDialog id: fetch_emergency_contacts @@ -59,7 +59,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" scenarioName: msdyn_HRWorkdayHCMEmployeeGetEmergencyContactInfo - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.fetchErrorResponse @@ -689,7 +689,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{Emergency_Contact_WID}"",""value"":""" & Topic.selectedContactWID & """},{""key"":""{Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""},{""key"":""{First_Name}"",""value"":""" & Topic.firstName & """},{""key"":""{Last_Name}"",""value"":""" & Topic.lastName & """},{""key"":""{Primary}"",""value"":""" & Topic.isPrimaryContact & """},{""key"":""{Priority}"",""value"":""" & If(Topic.isPrimaryContact = "true", "1", Topic.priority) & """},{""key"":""{Relationship_Type}"",""value"":""" & Topic.relationshipType & """},{""key"":""{Phone_Number}"",""value"":""" & Topic.phoneNumber & """},{""key"":""{Phone_Device_Type}"",""value"":""" & Topic.phoneDeviceType & """},{""key"":""{Phone_Country_Code}"",""value"":""" & Last(Split(Topic.phoneCountryCode, "_")).Value & """},{""key"":""{Address_Line_1}"",""value"":""" & Topic.addressLine1 & """},{""key"":""{City}"",""value"":""" & Topic.city & """},{""key"":""{State_Province}"",""value"":""" & Topic.stateProvince & """},{""key"":""{Postal_Code}"",""value"":""" & Topic.postalCode & """},{""key"":""{Country_Code}"",""value"":""" & Topic.countryCode & """},{""key"":""{Address_Country_Code}"",""value"":""" & Topic.countryCode & """},{""key"":""{Comment}"",""value"":""Updating emergency contact""}]}" scenarioName: msdyn_UpdateEmergencyContact - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse @@ -705,7 +705,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""},{""key"":""{First_Name}"",""value"":""" & Topic.firstName & """},{""key"":""{Last_Name}"",""value"":""" & Topic.lastName & """},{""key"":""{Primary}"",""value"":""" & Topic.isPrimaryContact & """},{""key"":""{Priority}"",""value"":""" & If(Topic.isPrimaryContact = "true", "1", Topic.priority) & """},{""key"":""{Relationship_Type}"",""value"":""" & Topic.relationshipType & """},{""key"":""{Phone_Number}"",""value"":""" & Topic.phoneNumber & """},{""key"":""{Phone_Device_Type}"",""value"":""" & Topic.phoneDeviceType & """},{""key"":""{Phone_Country_Code}"",""value"":""" & Last(Split(Topic.phoneCountryCode, "_")).Value & """},{""key"":""{Address_Line_1}"",""value"":""" & Topic.addressLine1 & """},{""key"":""{City}"",""value"":""" & Topic.city & """},{""key"":""{State_Province}"",""value"":""" & Topic.stateProvince & """},{""key"":""{Postal_Code}"",""value"":""" & Topic.postalCode & """},{""key"":""{Country_Code}"",""value"":""" & Topic.countryCode & """},{""key"":""{Address_Country_Code}"",""value"":""" & Topic.countryCode & """},{""key"":""{Comment}"",""value"":""Adding emergency contact""}]}" scenarioName: msdyn_AddEmergencyContact - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse diff --git a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/topic.yaml b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/topic.yaml index d88188e2..adecac4b 100644 --- a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayGetManagerReporteesTimeInPosition/topic.yaml @@ -22,7 +22,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{Manager_Org_ID}"",""value"":""" & Global.ESS_UserContext_ManagerOrganizationId & """}]}" scenarioName: msdyn_GetManagerReportees - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse diff --git a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagerServiceAnniversary/topic.yaml b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagerServiceAnniversary/topic.yaml index 790ca0d3..367c5fa9 100644 --- a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagerServiceAnniversary/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagerServiceAnniversary/topic.yaml @@ -48,7 +48,7 @@ beginDialog: - kind: BeginDialog id: WmAHrc displayName: Check manager criteria - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdayManagerCheck + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdayManagerCheck - kind: SetVariable id: setVariable_FrkyzI @@ -64,7 +64,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{ManagerOrgId}"",""value"":""" & Global.ESS_UserContext_ManagerOrganizationId & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" scenarioName: msdyn_HRWorkdayHCMManagerServiceAnniversary - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse diff --git a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagersdirect-CompanyCode/topic.yaml b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagersdirect-CompanyCode/topic.yaml index 4f382858..af8d36f2 100644 --- a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagersdirect-CompanyCode/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagersdirect-CompanyCode/topic.yaml @@ -33,7 +33,7 @@ beginDialog: - kind: BeginDialog id: dAhS4T displayName: Check manager status - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdayManagerCheck + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdayManagerCheck - kind: BeginDialog id: Gt044B @@ -43,7 +43,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{ManagerOrgId}"",""value"":""" & Global.ESS_UserContext_ManagerOrganizationId & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" scenarioName: msdyn_HRWorkdayHCMManagerDirectCompanyCode - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse diff --git a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagersdirect-CostCenter/topic.yaml b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagersdirect-CostCenter/topic.yaml index 2ecf133c..f22dfda5 100644 --- a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagersdirect-CostCenter/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagersdirect-CostCenter/topic.yaml @@ -33,7 +33,7 @@ beginDialog: - kind: BeginDialog id: 3VGa9O displayName: Check manager status - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdayManagerCheck + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdayManagerCheck - kind: BeginDialog id: jJpz3n @@ -43,7 +43,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{ManagerOrgId}"",""value"":""" & Global.ESS_UserContext_ManagerOrganizationId & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" scenarioName: msdyn_HRWorkdayHCMManagerDirectCostCenter - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse diff --git a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagersdirect-Jobtaxanomy/topic.yaml b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagersdirect-Jobtaxanomy/topic.yaml index 8b724189..f3eb009a 100644 --- a/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagersdirect-Jobtaxanomy/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/ManagerScenarios/WorkdayManagersdirect-Jobtaxanomy/topic.yaml @@ -43,7 +43,7 @@ beginDialog: - kind: BeginDialog id: Y8gqWh displayName: Check manager status - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdayManagerCheck + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdayManagerCheck - kind: BeginDialog id: 7Va4UU @@ -53,7 +53,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{ManagerOrgId}"",""value"":""" & Global.ESS_UserContext_ManagerOrganizationId & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" scenarioName: msdyn_HRWorkdayHCMManagerJobTaxonomy - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse @@ -119,7 +119,7 @@ beginDialog: IsTableEmpty: =IsBlank(Global.JobFamilyLookupTable) ReferenceDataKey: Job_Family_ID - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemRefreshReferenceData + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemRefreshReferenceData - kind: SetVariable id: setVariable_EFFdlM From b2c970c910ae53a67a9087aa745da5f312dfab56 Mon Sep 17 00:00:00 2001 From: Ankur Rana Date: Mon, 29 Dec 2025 15:39:20 +0530 Subject: [PATCH 3/7] Updating Scenario name in the topic definition --- .../msdyn_HRWorkdayHCMEmployeeAddEmergencyContact.xml | 2 +- .../EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeAddEmergencyContact.xml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeAddEmergencyContact.xml index 10d5e1b2..42b0f04f 100644 --- a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeAddEmergencyContact.xml +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeAddEmergencyContact.xml @@ -98,4 +98,4 @@ - + \ No newline at end of file diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml index a84cf83c..c8c9fb72 100644 --- a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/topic.yaml @@ -703,7 +703,7 @@ beginDialog: input: binding: parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""},{""key"":""{First_Name}"",""value"":""" & Topic.firstName & """},{""key"":""{Last_Name}"",""value"":""" & Topic.lastName & """},{""key"":""{Primary}"",""value"":""" & Topic.isPrimaryContact & """},{""key"":""{Priority}"",""value"":""" & If(Topic.isPrimaryContact = "true", "1", Topic.priority) & """},{""key"":""{Relationship_Type}"",""value"":""" & Topic.relationshipType & """},{""key"":""{Phone_Number}"",""value"":""" & Topic.phoneNumber & """},{""key"":""{Phone_Device_Type}"",""value"":""" & Topic.phoneDeviceType & """},{""key"":""{Phone_Country_Code}"",""value"":""" & Last(Split(Topic.phoneCountryCode, "_")).Value & """},{""key"":""{Address_Line_1}"",""value"":""" & Topic.addressLine1 & """},{""key"":""{City}"",""value"":""" & Topic.city & """},{""key"":""{State_Province}"",""value"":""" & Topic.stateProvince & """},{""key"":""{Postal_Code}"",""value"":""" & Topic.postalCode & """},{""key"":""{Country_Code}"",""value"":""" & Topic.countryCode & """},{""key"":""{Address_Country_Code}"",""value"":""" & Topic.countryCode & """},{""key"":""{Comment}"",""value"":""Adding emergency contact""}]}" - scenarioName: msdyn_AddEmergencyContact + scenarioName: msdyn_HRWorkdayHCMEmployeeAddEmergencyContact dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: From f707397680976d079c88350923b948f2491e891c Mon Sep 17 00:00:00 2001 From: Ankur Rana Date: Mon, 29 Dec 2025 17:09:46 +0530 Subject: [PATCH 4/7] Update Residential Address Scenario in Workday --- .../README.md | 140 ++++ .../UpdateResidentialAddress_Topic.yaml | 637 ++++++++++++++++++ .../msdyn_GetResidentialAddress_Template.xml | 106 +++ ...sdyn_UpdateResidentialAddress_Template.xml | 71 ++ 4 files changed, 954 insertions(+) create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/README.md create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/UpdateResidentialAddress_Topic.yaml create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/msdyn_GetResidentialAddress_Template.xml create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/msdyn_UpdateResidentialAddress_Template.xml diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/README.md b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/README.md new file mode 100644 index 00000000..bb855fc3 --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/README.md @@ -0,0 +1,140 @@ +# Workday Update Residential Address + +## Overview +This scenario enables employees to update their home/residential address in Workday through the Copilot agent. It retrieves the employee's current home addresses, allows them to select which one to update, and submits the changes via the Workday Change Home Contact Information API. + +## Files + +| File | Description | +|------|-------------| +| `UpdateResidentialAddress_Topic.yaml` | Copilot Studio topic definition with the complete workflow | +| `msdyn_GetResidentialAddress_Template.xml` | XML template to retrieve current home addresses | +| `msdyn_UpdateResidentialAddress_Template.xml` | XML template to update the home address | + +## Prerequisites + +### Global Variables Required +- `Global.ESS_UserContext_Employee_Id` - The employee's Workday Employee ID + +### Workday API +- **Service**: Human_Resources +- **Version**: v42.0 +- **Operations**: + - `Get_Workers` - To retrieve current address information + - `Change_Home_Contact_Information` - To update address + +## Workflow + +1. **Retrieve Current Addresses**: Calls Get_Workers API with `Include_Personal_Information` to get existing home addresses +2. **Select Address**: If multiple addresses exist, user selects which one to update +3. **Collect New Address**: Displays an Adaptive Card form pre-filled with current values +4. **Confirm Changes**: Shows summary of changes and asks for confirmation +5. **Submit Update**: Calls Change_Home_Contact_Information API to update the address +6. **Display Result**: Shows success or error message + +## Address Fields + +| Field | Required | Description | +|-------|----------|-------------| +| Address Line 1 | Yes | Street address | +| Address Line 2 | No | Apartment, Suite, Unit (optional) | +| City | Yes | Municipality | +| State/Province | Yes | State or Province code (e.g., USA-CA) | +| Country | Yes | ISO 3166-1 Alpha-3 code (e.g., USA, CAN) | +| Postal Code | Yes | ZIP or Postal code | +| Primary Address | No | Toggle to set as primary home address | + +## Supported Countries + +The Adaptive Card includes dropdown options for: +- United States (USA) +- Canada (CAN) +- United Kingdom (GBR) +- Australia (AUS) +- Germany (DEU) +- France (FRA) +- India (IND) +- Japan (JPN) +- Mexico (MEX) +- Brazil (BRA) + +## Supported States/Provinces + +Pre-configured for: +- All 50 US States + DC +- Canadian provinces (Ontario, Quebec, British Columbia, Alberta) + +> **Note**: To add more states/provinces, update the `stateProvince` choices in the Adaptive Card within the topic YAML. + +## Trigger Phrases + +- "Update my home address" +- "I want to update my residential address" +- "Change my address" +- "Update my street address" +- "I moved to a new address" + +## XML Template Parameters + +### Get Address Template (`msdyn_HRWorkdayHCMEmployeeGetResidentialAddress`) +| Parameter | Description | +|-----------|-------------| +| `{Employee_ID}` | Employee's Workday ID | +| `{As_Of_Effective_Date}` | Current date (yyyy-MM-dd format) | + +### Update Address Template (`msdyn_HRWorkdayHCMEmployeeUpdateResidentialAddress`) +| Parameter | Description | +|-----------|-------------| +| `{Employee_ID}` | Employee's Workday ID | +| `{Event_Effective_Date}` | Effective date of the change | +| `{Address_ID}` | ID of the address being updated | +| `{Country_Code}` | ISO 3166-1 Alpha-3 country code | +| `{State_Province_Code}` | Country Region ID (e.g., USA-CA) | +| `{Address_Line_1}` | Street address line 1 | +| `{Address_Line_2}` | Street address line 2 (optional) | +| `{City}` | Municipality name | +| `{Postal_Code}` | ZIP/Postal code | +| `{Is_Primary}` | true/false for primary address | + +## Response Extraction + +### Get Address Response +| Field | XPath | +|-------|-------| +| FormattedAddress | `//*[local-name()='Address_Data']/@*[local-name()='Formatted_Address']` | +| AddressID | `//*[local-name()='Address_ID']/text()` | +| CountryCode | `//*[local-name()='Country_Reference']/*[local-name()='ID' and @type='ISO_3166-1_Alpha-3_Code']` | +| StateProvinceCode | `//*[local-name()='Country_Region_Reference']/*[local-name()='ID' and @type='Country_Region_ID']` | +| City | `//*[local-name()='Municipality']/text()` | +| PostalCode | `//*[local-name()='Postal_Code']/text()` | + +## Setup Instructions + +1. **Import the Topic**: Import `UpdateResidentialAddress_Topic.yaml` into your Copilot Studio agent +2. **Add XML Templates**: Upload both XML templates to your Workday connector configuration +3. **Configure Connection**: Ensure your Workday connector connection reference is set in the topic +4. **Set Global Variable**: Ensure `Global.ESS_UserContext_Employee_Id` is populated from user authentication + +## Example Interaction + +**User**: "I need to update my home address" + +**Agent**: Shows current home addresses and asks which one to update + +**User**: Selects address + +**Agent**: Displays Adaptive Card with form fields pre-filled + +**User**: Updates fields and clicks "Update Address" + +**Agent**: Shows confirmation with new address details + +**User**: Confirms "Yes, update my address" + +**Agent**: "✅ Your home address has been successfully updated!" + +## Notes + +- The `Replace_All="false"` setting ensures only the selected address is updated without affecting other addresses +- Business process parameters include `Auto_Complete=false` and `Run_Now=true` for proper workflow handling +- Address validation is handled by Workday - ensure state/province codes match the country selected diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/UpdateResidentialAddress_Topic.yaml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/UpdateResidentialAddress_Topic.yaml new file mode 100644 index 00000000..25280b54 --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/UpdateResidentialAddress_Topic.yaml @@ -0,0 +1,637 @@ +kind: AdaptiveDialog +modelDescription: |- + You will respond only to requests related to updating the residential/home address of the user making the request. All address data is retrieved from and updated through Workday, and pertains exclusively to the requesting user. This topic may also prompt the user for input if they are requesting to make a change to their own home address. This data exclusively belongs to the user making the request. There is no data for anyone else. Do not respond to questions about other people's data. + + Example invalid requests: + "Update address for my manager" + "Update my sister's home address" + "Update [EmployeeName]'s address" + "Update address for [EmployeeName]" + + Example valid requests: + "Update my home address" + "I want to update my residential address" + "Change my address" + "Update my street address" + "I moved to a new address" + +beginDialog: + kind: OnRecognizedIntent + id: main + intent: {} + + actions: + # Step 1: Get current residential address + - kind: BeginDialog + id: getAddress_BeginDialog + displayName: Get Current Residential Address + input: + binding: + parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Now(), "yyyy-MM-dd") &"""}]}" + scenarioName: msdyn_HRWorkdayHCMEmployeeGetResidentialAddress + + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution + output: + binding: + errorResponse: Topic.errorResponse + isSuccess: Topic.isSuccess + workdayResponse: Topic.workdayResponse + + - kind: ConditionGroup + id: checkGetSuccess + conditions: + - id: getSuccessCondition + condition: =Topic.isSuccess = false + actions: + - kind: SendActivity + id: sendErrorMessage + activity: I encountered an error retrieving your current address. Please try again later or contact support. + + - kind: EndDialog + id: endOnError + + # Step 2: Parse the response + - kind: ParseValue + id: parseAddressResponse + displayName: Parse address response + variable: Topic.addressRecord + valueType: + kind: Record + properties: + FormattedAddress: + type: + kind: Table + properties: + Value: String + AddressID: + type: + kind: Table + properties: + Value: String + CountryCode: + type: + kind: Table + properties: + Value: String + StateProvinceCode: + type: + kind: Table + properties: + Value: String + City: + type: + kind: Table + properties: + Value: String + PostalCode: + type: + kind: Table + properties: + Value: String + AddressLine1: + type: + kind: Table + properties: + Value: String + AddressLine2: + type: + kind: Table + properties: + Value: String + IsPrimary: + type: + kind: Table + properties: + Value: String + UsageType: + type: + kind: Table + properties: + Value: String + value: =Topic.workdayResponse + + # Step 3: Transform to table and filter HOME addresses + - kind: SetVariable + id: setVariable_transformAddresses + displayName: Transform addresses to table + variable: Topic.addressTable + value: |- + =ForAll( + Sequence(CountRows(Topic.addressRecord.AddressID)), + { + AddressID: Last(FirstN(Topic.addressRecord.AddressID, Value)).Value, + FormattedAddress: Last(FirstN(Topic.addressRecord.FormattedAddress, Value)).Value, + CountryCode: Last(FirstN(Topic.addressRecord.CountryCode, Value)).Value, + StateProvinceCode: Last(FirstN(Topic.addressRecord.StateProvinceCode, Value)).Value, + City: Last(FirstN(Topic.addressRecord.City, Value)).Value, + PostalCode: Last(FirstN(Topic.addressRecord.PostalCode, Value)).Value, + AddressLine1: Last(FirstN(Topic.addressRecord.AddressLine1, Value)).Value, + AddressLine2: Last(FirstN(Topic.addressRecord.AddressLine2, Value)).Value, + IsPrimary: If(Last(FirstN(Topic.addressRecord.IsPrimary, Value)).Value = "1", true, false), + UsageType: Last(FirstN(Topic.addressRecord.UsageType, Value)).Value + } + ) + + # Filter to only HOME addresses + - kind: SetVariable + id: setVariable_homeAddresses + displayName: Filter to HOME addresses only + variable: Topic.homeAddresses + value: =Filter(Topic.addressTable, UsageType = "HOME") + + # Step 4: Check if user has existing home addresses + - kind: ConditionGroup + id: checkExistingAddresses + conditions: + - id: noAddressesCondition + condition: =CountRows(Topic.homeAddresses) = 0 + actions: + - kind: SendActivity + id: sendNoAddressMessage + activity: You don't have a home address on file. Would you like to add a new one? + + - kind: SetVariable + id: setIsNewAddress + variable: Topic.isNewAddress + value: =true + + - kind: SetVariable + id: setSelectedAddressID_New + variable: Topic.selectedAddressID + value: ="" + + elseActions: + - kind: SetVariable + id: setIsExistingAddress + variable: Topic.isNewAddress + value: =false + + # Check if single address (auto-select) or multiple (show selection) + - kind: ConditionGroup + id: checkSingleOrMultipleAddresses + conditions: + - id: singleAddressCondition + condition: =CountRows(Topic.homeAddresses) = 1 + displayName: Single address - auto-select + actions: + # Auto-select the only address + - kind: SetVariable + id: autoSelectAddress + displayName: Auto-select single address + variable: Topic.selectedAddress + value: =First(Topic.homeAddresses) + + - kind: SetVariable + id: autoSetAddressID + variable: Topic.selectedAddressID + value: =Topic.selectedAddress.AddressID + + - kind: SendActivity + id: sendCurrentAddressMsg + activity: |- + I found your current home address: + + 📍 **{Topic.selectedAddress.FormattedAddress}** + + elseActions: + # Multiple addresses - show selection card + - kind: SetVariable + id: buildAddressChoices + displayName: Build address selection choices + variable: Topic.addressChoices + value: | + =ForAll( + Topic.homeAddresses, + { + title: If(ThisRecord.IsPrimary, "⭐ ", "") & ThisRecord.FormattedAddress, + value: ThisRecord.AddressID + } + ) + + # Show address selection card + - kind: AdaptiveCardPrompt + id: selectAddressCard + displayName: Select address to update + card: |- + ={ + type: "AdaptiveCard", + '$schema': "http://adaptivecards.io/schemas/adaptive-card.json", + version: "1.3", + body: [ + { + type: "TextBlock", + text: "Update Residential Address", + weight: "Bolder", + size: "Medium", + wrap: true, + color: "Accent" + }, + { + type: "TextBlock", + text: "You have " & CountRows(Topic.homeAddresses) & " home addresses. Select the one you want to update.", + wrap: true + }, + { + type: "Input.ChoiceSet", + id: "selectedAddress", + label: "Select Address", + style: "expanded", + isRequired: true, + errorMessage: "Please select an address.", + choices: ForAll(Topic.addressChoices, { title: ThisRecord.title, value: ThisRecord.value }) + } + ], + actions: [ + { type: "Action.Submit", title: "Continue" }, + { type: "Action.Submit", title: "Cancel", associatedInputs: "none" } + ] + } + output: + binding: + actionSubmitId: Topic.selectionActionId + selectedAddress: Topic.selectedAddressID + outputType: + properties: + actionSubmitId: String + selectedAddress: String + + # Handle cancel + - kind: ConditionGroup + id: handleSelectionCancel + conditions: + - id: selectionCancelled + condition: =Topic.selectionActionId = "Cancel" + actions: + - kind: SendActivity + id: selectionCancelMsg + activity: Your request has been cancelled. Is there anything else I can help you with? + - kind: CancelAllDialogs + id: selectionCancelAll + + # Get the selected address details + - kind: SetVariable + id: setSelectedAddress + displayName: Set selected address details + variable: Topic.selectedAddress + value: =LookUp(Topic.homeAddresses, AddressID = Topic.selectedAddressID) + + # Set current address values for form pre-population + - kind: SetVariable + id: setCurrentAddressLine1 + variable: Topic.currentAddressLine1 + value: =Topic.selectedAddress.AddressLine1 + + - kind: SetVariable + id: setCurrentAddressLine2 + variable: Topic.currentAddressLine2 + value: =Topic.selectedAddress.AddressLine2 + + - kind: SetVariable + id: setCurrentCity + variable: Topic.currentCity + value: =Topic.selectedAddress.City + + - kind: SetVariable + id: setCurrentStateProvince + variable: Topic.currentStateProvince + value: =Topic.selectedAddress.StateProvinceCode + + - kind: SetVariable + id: setCurrentPostalCode + variable: Topic.currentPostalCode + value: =Topic.selectedAddress.PostalCode + + - kind: SetVariable + id: setCurrentCountryCode + variable: Topic.currentCountryCode + value: =Topic.selectedAddress.CountryCode + + - kind: SetVariable + id: setCurrentIsPrimary + variable: Topic.currentIsPrimary + value: =Topic.selectedAddress.IsPrimary + + # Step 5: Collect new address information using Adaptive Card + - kind: AdaptiveCardPrompt + id: collectAddressCard + displayName: Collect new address information + card: |- + ={ + type: "AdaptiveCard", + version: "1.5", + body: [ + { + type: "TextBlock", + text: "Update Your Home Address", + weight: "Bolder", + size: "Large" + }, + { + type: "TextBlock", + text: "Please enter your new address details:", + wrap: true + }, + { + type: "Input.Text", + id: "addressLine1", + label: "Address Line 1 *", + placeholder: "Street address", + isRequired: true, + value: If(IsBlank(Topic.currentAddressLine1), "", Topic.currentAddressLine1) + }, + { + type: "Input.Text", + id: "addressLine2", + label: "Address Line 2", + placeholder: "Apt, Suite, Unit, etc. (optional)", + value: If(IsBlank(Topic.currentAddressLine2), "", Topic.currentAddressLine2) + }, + { + type: "Input.Text", + id: "city", + label: "City *", + placeholder: "City", + isRequired: true, + value: If(IsBlank(Topic.currentCity), "", Topic.currentCity) + }, + { + type: "Input.ChoiceSet", + id: "country", + label: "Country *", + isRequired: true, + value: If(IsBlank(Topic.currentCountryCode), "USA", Topic.currentCountryCode), + choices: [ + { title: "United States", value: "USA" }, + { title: "Canada", value: "CAN" }, + { title: "United Kingdom", value: "GBR" }, + { title: "Australia", value: "AUS" }, + { title: "Germany", value: "DEU" }, + { title: "France", value: "FRA" }, + { title: "India", value: "IND" }, + { title: "Japan", value: "JPN" }, + { title: "Mexico", value: "MEX" }, + { title: "Brazil", value: "BRA" } + ] + }, + { + type: "Input.ChoiceSet", + id: "stateProvince", + label: "State/Province *", + isRequired: true, + value: If(IsBlank(Topic.currentStateProvince), "", Topic.currentStateProvince), + choices: [ + { title: "Alabama", value: "USA-AL" }, + { title: "Alaska", value: "USA-AK" }, + { title: "Arizona", value: "USA-AZ" }, + { title: "Arkansas", value: "USA-AR" }, + { title: "California", value: "USA-CA" }, + { title: "Colorado", value: "USA-CO" }, + { title: "Connecticut", value: "USA-CT" }, + { title: "Delaware", value: "USA-DE" }, + { title: "Florida", value: "USA-FL" }, + { title: "Georgia", value: "USA-GA" }, + { title: "Hawaii", value: "USA-HI" }, + { title: "Idaho", value: "USA-ID" }, + { title: "Illinois", value: "USA-IL" }, + { title: "Indiana", value: "USA-IN" }, + { title: "Iowa", value: "USA-IA" }, + { title: "Kansas", value: "USA-KS" }, + { title: "Kentucky", value: "USA-KY" }, + { title: "Louisiana", value: "USA-LA" }, + { title: "Maine", value: "USA-ME" }, + { title: "Maryland", value: "USA-MD" }, + { title: "Massachusetts", value: "USA-MA" }, + { title: "Michigan", value: "USA-MI" }, + { title: "Minnesota", value: "USA-MN" }, + { title: "Mississippi", value: "USA-MS" }, + { title: "Missouri", value: "USA-MO" }, + { title: "Montana", value: "USA-MT" }, + { title: "Nebraska", value: "USA-NE" }, + { title: "Nevada", value: "USA-NV" }, + { title: "New Hampshire", value: "USA-NH" }, + { title: "New Jersey", value: "USA-NJ" }, + { title: "New Mexico", value: "USA-NM" }, + { title: "New York", value: "USA-NY" }, + { title: "North Carolina", value: "USA-NC" }, + { title: "North Dakota", value: "USA-ND" }, + { title: "Ohio", value: "USA-OH" }, + { title: "Oklahoma", value: "USA-OK" }, + { title: "Oregon", value: "USA-OR" }, + { title: "Pennsylvania", value: "USA-PA" }, + { title: "Rhode Island", value: "USA-RI" }, + { title: "South Carolina", value: "USA-SC" }, + { title: "South Dakota", value: "USA-SD" }, + { title: "Tennessee", value: "USA-TN" }, + { title: "Texas", value: "USA-TX" }, + { title: "Utah", value: "USA-UT" }, + { title: "Vermont", value: "USA-VT" }, + { title: "Virginia", value: "USA-VA" }, + { title: "Washington", value: "USA-WA" }, + { title: "West Virginia", value: "USA-WV" }, + { title: "Wisconsin", value: "USA-WI" }, + { title: "Wyoming", value: "USA-WY" }, + { title: "District of Columbia", value: "USA-DC" }, + { title: "Ontario", value: "CAN-ON" }, + { title: "Quebec", value: "CAN-QC" }, + { title: "British Columbia", value: "CAN-BC" }, + { title: "Alberta", value: "CAN-AB" } + ] + }, + { + type: "Input.Text", + id: "postalCode", + label: "Postal/ZIP Code *", + placeholder: "Postal Code", + isRequired: true, + value: If(IsBlank(Topic.currentPostalCode), "", Topic.currentPostalCode) + }, + { + type: "Input.Toggle", + id: "isPrimary", + title: "Set as primary address", + value: If(Topic.currentIsPrimary = true, "true", "false"), + valueOn: "true", + valueOff: "false" + } + ], + actions: [ + { + type: "Action.Submit", + title: "Update Address", + data: { + action: "updateAddress" + } + }, + { + type: "Action.Submit", + title: "Cancel", + data: { + action: "cancel" + } + } + ] + } + output: + binding: + addressLine1: Topic.newAddressLine1 + addressLine2: Topic.newAddressLine2 + city: Topic.newCity + stateProvince: Topic.newStateProvince + country: Topic.newCountry + postalCode: Topic.newPostalCode + isPrimary: Topic.newIsPrimary + action: Topic.cardAction + outputType: + properties: + addressLine1: String + addressLine2: String + city: String + stateProvince: String + country: String + postalCode: String + isPrimary: String + action: String + + # Step 6: Check if user cancelled + - kind: ConditionGroup + id: checkCancelAction + conditions: + - id: cancelCondition + condition: =Topic.cardAction = "cancel" + actions: + - kind: SendActivity + id: sendCancelMessage + activity: Address update cancelled. No changes were made. + + - kind: EndDialog + id: endOnCancel + + # Step 7: Validate required fields + - kind: ConditionGroup + id: validateFields + conditions: + - id: missingFieldsCondition + condition: =IsBlank(Topic.newAddressLine1) || IsBlank(Topic.newCity) || IsBlank(Topic.newStateProvince) || IsBlank(Topic.newPostalCode) + actions: + - kind: SendActivity + id: sendValidationError + activity: Please fill in all required fields (Address Line 1, City, State/Province, and Postal Code). + + - kind: EndDialog + id: endOnValidationError + + # Step 8: Show confirmation before update + - kind: AdaptiveCardPrompt + id: confirmUpdateCard + displayName: Confirm address update + card: |- + ={ + type: "AdaptiveCard", + '$schema': "http://adaptivecards.io/schemas/adaptive-card.json", + version: "1.3", + body: [ + { + type: "TextBlock", + text: "Confirm Address Update", + weight: "Bolder", + size: "Medium", + wrap: true, + color: "Accent" + }, + { + type: "TextBlock", + text: "Please review your new address details:", + wrap: true + }, + { + type: "FactSet", + facts: [ + { title: "Address Line 1", value: Topic.newAddressLine1 }, + { title: "Address Line 2", value: If(IsBlank(Topic.newAddressLine2), "-", Topic.newAddressLine2) }, + { title: "City", value: Topic.newCity }, + { title: "State/Province", value: Topic.newStateProvince }, + { title: "Country", value: Topic.newCountry }, + { title: "Postal Code", value: Topic.newPostalCode }, + { title: "Primary Address", value: If(Topic.newIsPrimary = "true", "Yes", "No") } + ] + }, + { + type: "TextBlock", + text: "Do you want to proceed with this update?", + wrap: true, + weight: "Bolder" + } + ], + actions: [ + { type: "Action.Submit", title: "Yes, Update Address" }, + { type: "Action.Submit", title: "Cancel", associatedInputs: "none" } + ] + } + output: + binding: + actionSubmitId: Topic.confirmActionId + outputType: + properties: + actionSubmitId: String + + - kind: ConditionGroup + id: checkConfirmation + conditions: + - id: notConfirmedCondition + condition: =Topic.confirmActionId = "Cancel" + actions: + - kind: SendActivity + id: sendNotConfirmedMessage + activity: Address update cancelled. No changes were made. + + - kind: EndDialog + id: endOnNotConfirmed + + # Step 9: Call Update API + - kind: BeginDialog + id: updateAddress_BeginDialog + displayName: Update Residential Address + input: + binding: + parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{Event_Effective_Date}"",""value"":"""& Text(Now(), "yyyy-MM-dd") &"""},{""key"":""{Address_ID}"",""value"":""" & Topic.selectedAddressID & """},{""key"":""{Country_Code}"",""value"":""" & Topic.newCountry & """},{""key"":""{State_Province_Code}"",""value"":""" & Topic.newStateProvince & """},{""key"":""{Address_Line_1}"",""value"":""" & Topic.newAddressLine1 & """},{""key"":""{Address_Line_2}"",""value"":""" & If(IsBlank(Topic.newAddressLine2), "", Topic.newAddressLine2) & """},{""key"":""{City}"",""value"":""" & Topic.newCity & """},{""key"":""{Postal_Code}"",""value"":""" & Topic.newPostalCode & """},{""key"":""{Is_Primary}"",""value"":""" & If(Topic.newIsPrimary = "true", "true", "false") & """}]}" + scenarioName: msdyn_HRWorkdayHCMEmployeeUpdateResidentialAddress + + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution + output: + binding: + errorResponse: Topic.updateErrorResponse + isSuccess: Topic.updateIsSuccess + workdayResponse: Topic.updateWorkdayResponse + + # Step 10: Show result + - kind: ConditionGroup + id: checkUpdateSuccess + conditions: + - id: updateSuccessCondition + condition: =Topic.updateIsSuccess = true + actions: + - kind: SendActivity + id: sendSuccessMessage + activity: |- + ✅ Your home address has been successfully updated! + + **New Address:** + {Topic.newAddressLine1} + {If(!IsBlank(Topic.newAddressLine2), Topic.newAddressLine2 & Char(10), "")} + {Topic.newCity}, {Topic.newStateProvince} {Topic.newPostalCode} + {Topic.newCountry} + + elseActions: + - kind: SendActivity + id: sendUpdateErrorMessage + activity: |- + ❌ There was an error updating your address. Please try again later or contact support. + + Error: {Topic.updateErrorResponse} + +inputType: {} +outputType: + properties: + updateIsSuccess: + displayName: Update Success + type: Boolean diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/msdyn_GetResidentialAddress_Template.xml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/msdyn_GetResidentialAddress_Template.xml new file mode 100644 index 00000000..e3424dc9 --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/msdyn_GetResidentialAddress_Template.xml @@ -0,0 +1,106 @@ + + + + + User + + Template_GetResidentialAddressRequest + Human_Resources + v42.0 + + + + //*[local-name()='Contact_Data']/*[local-name()='Address_Data']/@*[local-name()='Formatted_Address'] + FormattedAddress + + + //*[local-name()='Contact_Data']/*[local-name()='Address_Data']/*[local-name()='Address_ID']/text() + AddressID + + + //*[local-name()='Contact_Data']/*[local-name()='Address_Data']/*[local-name()='Country_Reference']/*[local-name()='ID' and @*[local-name()='type']='ISO_3166-1_Alpha-3_Code']/text() + CountryCode + + + //*[local-name()='Contact_Data']/*[local-name()='Address_Data']/*[local-name()='Country_Region_Reference']/*[local-name()='ID' and @*[local-name()='type']='Country_Region_ID']/text() + StateProvinceCode + + + //*[local-name()='Contact_Data']/*[local-name()='Address_Data']/*[local-name()='Municipality']/text() + City + + + //*[local-name()='Contact_Data']/*[local-name()='Address_Data']/*[local-name()='Postal_Code']/text() + PostalCode + + + //*[local-name()='Contact_Data']/*[local-name()='Address_Data']/*[local-name()='Address_Line_Data' and @*[local-name()='Type']='ADDRESS_LINE_1']/text() + AddressLine1 + + + //*[local-name()='Contact_Data']/*[local-name()='Address_Data']/*[local-name()='Address_Line_Data' and @*[local-name()='Type']='ADDRESS_LINE_2']/text() + AddressLine2 + + + //*[local-name()='Contact_Data']/*[local-name()='Address_Data']/*[local-name()='Usage_Data']/*[local-name()='Type_Data']/@*[local-name()='Primary'] + IsPrimary + + + //*[local-name()='Contact_Data']/*[local-name()='Address_Data']/*[local-name()='Usage_Data']/*[local-name()='Type_Data']/*[local-name()='Type_Reference']/*[local-name()='ID' and @*[local-name()='type']='Communication_Usage_Type_ID']/text() + UsageType + + + + + + + + + + + {Employee_ID} + + + + {As_Of_Effective_Date} + + + true + true + false + false + true + true + true + true + true + true + true + true + true + true + true + true + true + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + false + + + + + diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/msdyn_UpdateResidentialAddress_Template.xml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/msdyn_UpdateResidentialAddress_Template.xml new file mode 100644 index 00000000..6110c982 --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeUpdateResidentialAddress/msdyn_UpdateResidentialAddress_Template.xml @@ -0,0 +1,71 @@ + + + + + User + + Template_UpdateResidentialAddressRequest + Human_Resources + v42.0 + + + + //*[local-name()='Event_Reference']/*[local-name()='ID' and @*[local-name()='type']='WID']/text() + EventWID + + + + + + + + + + false + true + true + + Address updated via Copilot + + {Employee_ID} + + + + + + {Employee_ID} + + {Event_Effective_Date} + + + + + + {Country_Code} + + + {State_Province_Code} + + {Address_Line_1} + {Address_Line_2} + {Postal_Code} + {City} + + + + + HOME + + + + + {Address_ID} + + + + + + + + + From bf8aef456ba1c11379996db1068bdd0fc9a7ff36 Mon Sep 17 00:00:00 2001 From: Ankur Rana Date: Mon, 29 Dec 2025 17:10:14 +0530 Subject: [PATCH 5/7] Updating scenario name --- .../EmployeeGetVacationBalance/topic.yaml | 2 +- .../WorkdayEmployeeRequestTimeOff/topic.yaml | 2 +- .../WorkdayEmployeesviewtheirjobtaxonomy/topic.yaml | 4 ++-- .../WorkdayGetContactInformation/topic.yaml | 8 ++++---- .../EmployeeScenarios/WorkdayGetEducation/topic.yaml | 10 +++++----- .../WorkdayGetGovernmentIDs/topic.yaml | 8 ++++---- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeGetVacationBalance/topic.yaml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeGetVacationBalance/topic.yaml index 8750fe6f..7b06fd02 100644 --- a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeGetVacationBalance/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeGetVacationBalance/topic.yaml @@ -91,7 +91,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Topic.AsOfEffectiveDate, "yyyy-MM-dd") &"""}]}" scenarioName: msdyn_HRWorkdayHCMEmployeeGetVacationBalance - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayEmployeeRequestTimeOff/topic.yaml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayEmployeeRequestTimeOff/topic.yaml index 0265a416..e0a6a559 100644 --- a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayEmployeeRequestTimeOff/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayEmployeeRequestTimeOff/topic.yaml @@ -44,7 +44,7 @@ beginDialog: binding: EmployeeName: =Topic.EmployeeName - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemAccessCheck + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemAccessCheck - kind: SetVariable id: set_website_message diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayEmployeesviewtheirjobtaxonomy/topic.yaml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayEmployeesviewtheirjobtaxonomy/topic.yaml index f6f9e8a6..cd80c742 100644 --- a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayEmployeesviewtheirjobtaxonomy/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayEmployeesviewtheirjobtaxonomy/topic.yaml @@ -32,7 +32,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" scenarioName: msdyn_HRWorkdayHCMEmployeeGetJobTaxonomy - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse @@ -91,7 +91,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{Job_Family_ID}"",""value"":""" & Topic.transformResponse.JobFamilyId & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" scenarioName: msdyn_HRWorkdayHCMEmployeeGetJobTaxonomyGeneric - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetContactInformation/topic.yaml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetContactInformation/topic.yaml index 9f9e092d..24c261ce 100644 --- a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetContactInformation/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetContactInformation/topic.yaml @@ -45,7 +45,7 @@ beginDialog: binding: EmployeeName: =Topic.EmployeeName - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemAccessCheck + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemAccessCheck - kind: BeginDialog id: Z6efSa @@ -55,7 +55,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" scenarioName: ="msdyn_HRWorkdayHCMEmployeeGetWorkContactInformation" - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse @@ -193,7 +193,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" scenarioName: msdyn_HRWorkdayHCMEmployeeGetHomeContactInformation - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse @@ -338,7 +338,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" scenarioName: msdyn_HRWorkdayHCMEmployeeGetWorkAddress - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetEducation/topic.yaml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetEducation/topic.yaml index 6a8f56ee..3b1b48c6 100644 --- a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetEducation/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetEducation/topic.yaml @@ -35,7 +35,7 @@ beginDialog: binding: EmployeeName: =Topic.EmployeeName - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemAccessCheck + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemAccessCheck - kind: BeginDialog id: B7ae9T @@ -45,7 +45,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" scenarioName: msdyn_HRWorkdayHCMEmployeeGetEducation - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse @@ -156,7 +156,7 @@ beginDialog: IsTableEmpty: =IsBlank(Global.CountryNameLookupTable) ReferenceDataKey: ISO_3166-1_Alpha-2_Code - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemRefreshReferenceData + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemRefreshReferenceData - kind: BeginDialog id: iM5A5i @@ -166,7 +166,7 @@ beginDialog: IsTableEmpty: =IsBlank(Global.DegreeTypeLookupTable) ReferenceDataKey: Degree_ID - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemRefreshReferenceData + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemRefreshReferenceData - kind: BeginDialog id: zG3du7 @@ -176,7 +176,7 @@ beginDialog: IsTableEmpty: =IsBlank(Global.FieldOfStudyLookupTable) ReferenceDataKey: Field_Of_Study_ID - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemRefreshReferenceData + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemRefreshReferenceData - kind: SetVariable id: setVariable_nD5Gkb diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetGovernmentIDs/topic.yaml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetGovernmentIDs/topic.yaml index b03cfa25..f7a6fa9f 100644 --- a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetGovernmentIDs/topic.yaml +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayGetGovernmentIDs/topic.yaml @@ -35,7 +35,7 @@ beginDialog: binding: EmployeeName: =Topic.EmployeeName - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemAccessCheck + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemAccessCheck - kind: BeginDialog id: 3bFDxH @@ -45,7 +45,7 @@ beginDialog: parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Today(), "yyyy-MM-dd") &"""}]}" scenarioName: msdyn_HRWorkdayHCMEmployeeGetGovernmentIds - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemGetCommonExecution + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution output: binding: errorResponse: Topic.errorResponse @@ -99,7 +99,7 @@ beginDialog: IsTableEmpty: =IsBlank(Global.CountryNameLookupTable) ReferenceDataKey: ISO_3166-1_Alpha-2_Code - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemRefreshReferenceData + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemRefreshReferenceData - kind: BeginDialog id: Xoydcu @@ -109,7 +109,7 @@ beginDialog: IsTableEmpty: =IsBlank(Global.GovernmentIdTypeLookupTable) ReferenceDataKey: Government_ID_Type_ID - dialog: msdyn_copilotforemployeeselfservice.topic.WorkdaySystemRefreshReferenceData + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemRefreshReferenceData - kind: SetVariable id: setVariable_ZYrAxQ From a7a461d7ba510c3c1b485bfac45fb6e048b73ba5 Mon Sep 17 00:00:00 2001 From: Ankur Rana Date: Tue, 30 Dec 2025 12:50:32 +0530 Subject: [PATCH 6/7] Handing Dependents from Get Emergency Contacts --- .../msdyn_HRWorkdayHCMEmployeeGetEmergencyContactInfo.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeGetEmergencyContactInfo.xml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeGetEmergencyContactInfo.xml index 42b00aab..6864baff 100644 --- a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeGetEmergencyContactInfo.xml +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/WorkdayManageEmergencyContact/msdyn_HRWorkdayHCMEmployeeGetEmergencyContactInfo.xml @@ -5,13 +5,13 @@ User - Template_GetEmergencyContactInfoRequest + Template_GetContactInfoRequest Human_Resources v45.0 - //*[local-name()='Related_Person_Data']//*[local-name()='Related_Person'] + //*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Emergency_Contact']] EmergencyContacts @@ -19,7 +19,7 @@ - + @@ -35,4 +35,4 @@ - + \ No newline at end of file From 9e79d310268644f3d34977a035e75e9655e27caf Mon Sep 17 00:00:00 2001 From: Ankur Rana Date: Tue, 30 Dec 2025 12:55:50 +0530 Subject: [PATCH 7/7] Adding Employee Add Dependents --- .../EmployeeAddDependents/README.md | 168 +++++++ ...msdyn_HRWorkdayHCMEmployeeAddDependent.xml | 65 +++ ...sdyn_HRWorkdayHCMEmployeeGetDependents.xml | 104 +++++ .../EmployeeAddDependents/topic.yaml | 421 ++++++++++++++++++ 4 files changed, 758 insertions(+) create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/README.md create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/msdyn_HRWorkdayHCMEmployeeAddDependent.xml create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/msdyn_HRWorkdayHCMEmployeeGetDependents.xml create mode 100644 EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/topic.yaml diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/README.md b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/README.md new file mode 100644 index 00000000..e583f433 --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/README.md @@ -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 \ No newline at end of file diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/msdyn_HRWorkdayHCMEmployeeAddDependent.xml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/msdyn_HRWorkdayHCMEmployeeAddDependent.xml new file mode 100644 index 00000000..02744f36 --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/msdyn_HRWorkdayHCMEmployeeAddDependent.xml @@ -0,0 +1,65 @@ + + + + + User + + Template_AddDependentRequest + Benefits_Administration + v45.1 + + + + //*[local-name()='Dependent_Reference']/*[local-name()='ID' and @*[local-name()='type']='WID']/text() + DependentWID + + + //*[local-name()='Dependent_Reference']/*[local-name()='ID' and @*[local-name()='type']='Dependent_ID']/text() + DependentID + + + + + + + + + + true + true + true + + Dependent added via Copilot + + {Employee_ID} + + + + + + {Employee_ID} + + + {Relationship_Type} + + true + + + + + {Country_Code} + + {First_Name} + {Last_Name} + + + {Date_Of_Birth} + + {Gender} + + + + + + + diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/msdyn_HRWorkdayHCMEmployeeGetDependents.xml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/msdyn_HRWorkdayHCMEmployeeGetDependents.xml new file mode 100644 index 00000000..7a87290b --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/msdyn_HRWorkdayHCMEmployeeGetDependents.xml @@ -0,0 +1,104 @@ + + + + + User + + Template_GetDependentsRequest + Human_Resources + v42.0 + + + + + + + + //*[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() + DependentID + + + + //*[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() + DependentWID + + + + //*[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() + PersonWID + + + + //*[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'] + FullName + + + + //*[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() + FirstName + + + + //*[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() + LastName + + + + //*[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() + DateOfBirth + + + + //*[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() + Gender + + + + //*[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() + RelationshipTypeID + + + + //*[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() + IsFullTimeStudent + + + + //*[local-name()='Related_Person_Data']/*[local-name()='Related_Person'][*[local-name()='Dependent']]/*[local-name()='Dependent']/*[local-name()='Dependent_Data']/*[local-name()='Disabled']/text() + IsDisabled + + + + + + + + + + + {Employee_ID} + + + + {As_Of_Effective_Date} + + + true + false + false + false + false + false + false + false + true + false + false + false + false + false + + + + + diff --git a/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/topic.yaml b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/topic.yaml new file mode 100644 index 00000000..3f39d92d --- /dev/null +++ b/EmployeeSelfServiceAgent/Workday/EmployeeScenarios/EmployeeAddDependents/topic.yaml @@ -0,0 +1,421 @@ +kind: AdaptiveDialog +modelDescription: |- + You will respond only to requests related to adding or managing dependents for the user making the request. + Dependents include spouses, domestic partners, children, and other family members who may be covered under employee benefits. + All dependent data is retrieved from and submitted to Workday, and pertains exclusively to the requesting user. + This data exclusively belongs to the user making the request. Do not respond to questions about other people's data. + + Example invalid requests: + "Add a dependent for my manager" + "Update dependents for [EmployeeName]" + "Show dependents for my colleague" + + Example valid requests: + "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" + +beginDialog: + kind: OnRecognizedIntent + id: main + intent: {} + + actions: + # Step 1: Fetch reference data for relationship types + - kind: ConditionGroup + id: checkRelationshipTypes + conditions: + - id: relationshipTypesUninitialized + condition: =IsBlank(Global.RelatedPersonRelationshipLookupTable) + displayName: If relationship type picklist is uninitialized + actions: + - kind: BeginDialog + id: fetchRelationshipTypes + displayName: Redirect to Workday System Get Reference Data + input: + binding: + referenceDataKey: Related_Person_Relationship_ID + dialog: msdyn_copilotforemployeeselfservicehr.topic.GetReferenceData + + # Step 2: Fetch existing dependents + - kind: BeginDialog + id: getDependents_BeginDialog + displayName: Get Current Dependents + input: + binding: + parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{As_Of_Effective_Date}"",""value"":"""& Text(Now(), "yyyy-MM-dd") &"""}]}" + scenarioName: msdyn_HRWorkdayHCMEmployeeGetDependents + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution + output: + binding: + errorResponse: Topic.errorResponse + isSuccess: Topic.isSuccess + workdayResponse: Topic.workdayResponse + + - kind: ConditionGroup + id: checkGetSuccess + conditions: + - id: getSuccessCondition + condition: =Topic.isSuccess = false + actions: + - kind: SendActivity + id: sendErrorMessage + activity: I encountered an error retrieving your dependent information. Please try again later or contact support. + - kind: EndDialog + id: endOnError + + # Step 3: Parse the response + - kind: ParseValue + id: parseDependentsResponse + displayName: Parse dependents response + variable: Topic.dependentsRecord + valueType: + kind: Record + properties: + DependentID: + type: + kind: Table + properties: + Value: String + DependentWID: + type: + kind: Table + properties: + Value: String + PersonWID: + type: + kind: Table + properties: + Value: String + FullName: + type: + kind: Table + properties: + Value: String + FirstName: + type: + kind: Table + properties: + Value: String + LastName: + type: + kind: Table + properties: + Value: String + DateOfBirth: + type: + kind: Table + properties: + Value: String + Gender: + type: + kind: Table + properties: + Value: String + RelationshipTypeID: + type: + kind: Table + properties: + Value: String + IsFullTimeStudent: + type: + kind: Table + properties: + Value: String + IsDisabled: + type: + kind: Table + properties: + Value: String + value: =Topic.workdayResponse + + # Step 4: Transform to table (XPath already filters to only actual dependents) + - kind: SetVariable + id: setVariable_transformDependents + displayName: Transform dependents to table + variable: Topic.dependentsTable + value: |- + =ForAll( + Sequence(CountRows(Topic.dependentsRecord.DependentID)), + { + DependentID: Last(FirstN(Topic.dependentsRecord.DependentID, Value)).Value, + DependentWID: Last(FirstN(Topic.dependentsRecord.DependentWID, Value)).Value, + PersonWID: Last(FirstN(Topic.dependentsRecord.PersonWID, Value)).Value, + FullName: Last(FirstN(Topic.dependentsRecord.FullName, Value)).Value, + FirstName: Last(FirstN(Topic.dependentsRecord.FirstName, Value)).Value, + LastName: Last(FirstN(Topic.dependentsRecord.LastName, Value)).Value, + DateOfBirth: Last(FirstN(Topic.dependentsRecord.DateOfBirth, Value)).Value, + Gender: Last(FirstN(Topic.dependentsRecord.Gender, Value)).Value, + RelationshipType: LookUp(Global.RelatedPersonRelationshipLookupTable, ID = Last(FirstN(Topic.dependentsRecord.RelationshipTypeID, Value)).Value).Referenced_Object_Descriptor, + RelationshipTypeID: Last(FirstN(Topic.dependentsRecord.RelationshipTypeID, Value)).Value, + IsFullTimeStudent: Last(FirstN(Topic.dependentsRecord.IsFullTimeStudent, Value)).Value = "1", + IsDisabled: Last(FirstN(Topic.dependentsRecord.IsDisabled, Value)).Value = "1" + } + ) + + # Step 5: Show existing dependents and option to add new + - kind: ConditionGroup + id: checkExistingDependents + conditions: + - id: hasDependentsCondition + condition: =CountRows(Topic.dependentsTable) > 0 + actions: + - kind: SendActivity + id: sendExistingDependentsMsg + activity: |- + You currently have **{CountRows(Topic.dependentsTable)}** dependent(s) on file: + + {Concat(Topic.dependentsTable, "• " & FullName & " (" & RelationshipType & ")" & Char(10))} + + Let's add a new dependent. + + elseActions: + - kind: SendActivity + id: sendNoDependentsMsg + activity: You don't have any dependents on file yet. Let's add one now. + + # Step 6: Collect dependent information using Adaptive Card + - kind: AdaptiveCardPrompt + id: collectDependentCard + displayName: Collect dependent information + card: |- + ={ + type: "AdaptiveCard", + '$schema': "http://adaptivecards.io/schemas/adaptive-card.json", + version: "1.3", + body: [ + { + type: "TextBlock", + text: "Add New Dependent", + weight: "Bolder", + size: "Large", + color: "Accent" + }, + { + type: "TextBlock", + text: "Please enter the dependent's information:", + wrap: true + }, + { + type: "Input.Text", + id: "firstName", + label: "First Name", + placeholder: "Enter first name", + isRequired: true + }, + { + type: "Input.Text", + id: "lastName", + label: "Last Name", + placeholder: "Enter last name", + isRequired: true + }, + { + type: "Input.Date", + id: "dateOfBirth", + label: "Date of Birth", + isRequired: true + }, + { + type: "Input.ChoiceSet", + id: "gender", + label: "Gender", + isRequired: true, + choices: [ + { title: "Male", value: "Male" }, + { title: "Female", value: "Female" }, + { title: "Not Declared", value: "Not_Declared" } + ] + }, + { + type: "Input.ChoiceSet", + id: "relationshipType", + label: "Relationship", + isRequired: true, + choices: ForAll(Global.RelatedPersonRelationshipLookupTable, { title: ThisRecord.Referenced_Object_Descriptor, value: ThisRecord.ID }) + }, + { + type: "Input.ChoiceSet", + id: "country", + label: "Country", + isRequired: true, + value: "USA", + choices: [ + { title: "United States", value: "USA" }, + { title: "Canada", value: "CAN" }, + { title: "United Kingdom", value: "GBR" }, + { title: "Australia", value: "AUS" }, + { title: "Germany", value: "DEU" }, + { title: "France", value: "FRA" }, + { title: "India", value: "IND" } + ] + } + ], + actions: [ + { type: "Action.Submit", title: "Add Dependent" }, + { type: "Action.Submit", title: "Cancel", associatedInputs: "none" } + ] + } + output: + binding: + actionSubmitId: Topic.formActionId + firstName: Topic.firstName + lastName: Topic.lastName + dateOfBirth: Topic.dateOfBirth + gender: Topic.gender + relationshipType: Topic.relationshipType + country: Topic.country + outputType: + properties: + actionSubmitId: String + firstName: String + lastName: String + dateOfBirth: String + gender: String + relationshipType: String + country: String + + # Step 7: Handle cancel + - kind: ConditionGroup + id: checkCancelAction + conditions: + - id: cancelCondition + condition: =Topic.formActionId = "Cancel" + actions: + - kind: SendActivity + id: sendCancelMessage + activity: Request cancelled. No dependent was added. Is there anything else I can help you with? + - kind: CancelAllDialogs + id: cancelAll + + # Step 8: Validate required fields + - kind: ConditionGroup + id: validateFields + conditions: + - id: missingFieldsCondition + condition: =IsBlank(Topic.firstName) || IsBlank(Topic.lastName) || IsBlank(Topic.dateOfBirth) || IsBlank(Topic.gender) || IsBlank(Topic.relationshipType) + actions: + - kind: SendActivity + id: sendValidationError + activity: Please fill in all required fields (First Name, Last Name, Date of Birth, Gender, and Relationship). + - kind: EndDialog + id: endOnValidationError + + # Step 9: Set relationship type ID (already comes from lookup table) + - kind: SetVariable + id: mapRelationshipType + displayName: Set relationship type ID + variable: Topic.relationshipTypeId + value: =Topic.relationshipType + + # Step 10: Show confirmation before adding + - kind: AdaptiveCardPrompt + id: confirmAddCard + displayName: Confirm dependent details + card: |- + ={ + type: "AdaptiveCard", + '$schema': "http://adaptivecards.io/schemas/adaptive-card.json", + version: "1.3", + body: [ + { + type: "TextBlock", + text: "Confirm New Dependent", + weight: "Bolder", + size: "Medium", + wrap: true, + color: "Accent" + }, + { + type: "TextBlock", + text: "Please review the dependent details:", + wrap: true + }, + { + type: "FactSet", + facts: [ + { title: "Name", value: Topic.firstName & " " & Topic.lastName }, + { title: "Date of Birth", value: Topic.dateOfBirth }, + { title: "Gender", value: Topic.gender }, + { title: "Relationship", value: LookUp(Global.RelatedPersonRelationshipLookupTable, ID = Topic.relationshipType).Referenced_Object_Descriptor }, + { title: "Country", value: Topic.country } + ] + }, + { + type: "TextBlock", + text: "Do you want to add this dependent?", + wrap: true, + weight: "Bolder" + } + ], + actions: [ + { type: "Action.Submit", title: "Yes, Add Dependent" }, + { type: "Action.Submit", title: "Cancel", associatedInputs: "none" } + ] + } + output: + binding: + actionSubmitId: Topic.confirmActionId + outputType: + properties: + actionSubmitId: String + + - kind: ConditionGroup + id: checkConfirmation + conditions: + - id: notConfirmedCondition + condition: =Topic.confirmActionId = "Cancel" + actions: + - kind: SendActivity + id: sendNotConfirmedMessage + activity: Request cancelled. No dependent was added. + - kind: EndDialog + id: endOnNotConfirmed + + # Step 10: Call Add Dependent API + - kind: BeginDialog + id: addDependent_BeginDialog + displayName: Add Dependent to Workday + input: + binding: + parameters: ="{""params"":[{""key"":""{Employee_ID}"",""value"":""" & Global.ESS_UserContext_Employee_Id & """},{""key"":""{First_Name}"",""value"":""" & Topic.firstName & """},{""key"":""{Last_Name}"",""value"":""" & Topic.lastName & """},{""key"":""{Date_Of_Birth}"",""value"":""" & Topic.dateOfBirth & """},{""key"":""{Gender}"",""value"":""" & Topic.gender & """},{""key"":""{Relationship_Type}"",""value"":""" & Topic.relationshipTypeId & """},{""key"":""{Country_Code}"",""value"":""" & Topic.country & """}]}" + scenarioName: msdyn_HRWorkdayHCMEmployeeAddDependent + dialog: msdyn_copilotforemployeeselfservicehr.topic.WorkdaySystemGetCommonExecution + output: + binding: + errorResponse: Topic.addErrorResponse + isSuccess: Topic.addIsSuccess + workdayResponse: Topic.addWorkdayResponse + + # Step 11: Show result + - kind: ConditionGroup + id: checkAddSuccess + conditions: + - id: addSuccessCondition + condition: =Topic.addIsSuccess = true + actions: + - kind: SendActivity + id: sendSuccessMessage + activity: |- + ✅ **Dependent added successfully!** + + **{Topic.firstName} {Topic.lastName}** has been added as your **{LookUp(Global.RelatedPersonRelationshipLookupTable, ID = Topic.relationshipType).Referenced_Object_Descriptor}**. + + Please note that depending on your company's policies, this change may require approval before it takes effect. + + elseActions: + - kind: SendActivity + id: sendAddErrorMessage + activity: |- + ❌ There was an error adding the dependent. Please try again later or contact HR support. + + Error: {Topic.addErrorResponse} + +inputType: {} +outputType: + properties: + addIsSuccess: + displayName: Add Success + type: Boolean