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 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} + + + + + + + + +