kind: AdaptiveDialog
beginDialog:
  kind: OnRedirect
  id: main
  actions:
    - kind: InvokeConnectorAction
      id: invokeConnectorAction_1SOOUe
      input:
        binding:
          sysparm_limit: 1
          sysparm_query: =Concatenate("email=",System.User.PrincipalName)
          tableType: sys_user

      output:
        kind: SingleVariableOutputBinding
        variable: Topic.GetServiceNowUser

      connectionReference: crb50_hrSelfService.shared_service-now.shared-service-now-e874ff4e-674f-4646-85af-62d958aaafe1
      connectionProperties:
        mode: Maker

      dynamicOutputSchema:
        kind: Record
        properties:
          result:
            order: 0
            type:
              kind: Table
              properties:
                active:
                  displayName: Active
                  description: Inactive users do not show in user choice lists
                  order: 22
                  type: String

                avatar:
                  displayName: Avatar
                  order: 53
                  type: String

                building:
                  displayName: Building
                  order: 6
                  type: String

                calendar_integration:
                  displayName: Calendar integration
                  order: 0
                  type: String

                city:
                  displayName: City
                  order: 30
                  type: String

                company:
                  displayName: Company
                  order: 42
                  type: String

                cost_center:
                  displayName: Cost center
                  order: 24
                  type: String

                country:
                  displayName: Country code
                  order: 1
                  type: String

                date_format:
                  displayName: Date format
                  description: Display dates with this format (blank means system default)
                  order: 58
                  type: String

                default_perspective:
                  displayName: Default perspective
                  order: 21
                  type: String

                department:
                  displayName: Department
                  order: 43
                  type: String

                email:
                  displayName: Email
                  order: 45
                  type: String

                employee_number:
                  displayName: Employee number
                  order: 27
                  type: String

                enable_multifactor_authn:
                  displayName: Enable Multifactor Authentication
                  order: 9
                  type: String

                failed_attempts:
                  displayName: Failed login attempts
                  order: 31
                  type: String

                fax:
                  displayName: Fax
                  order: 14
                  type: String

                federated_id:
                  displayName: Federated ID
                  order: 37
                  type: String

                first_name:
                  displayName: First name
                  order: 44
                  type: String

                gender:
                  displayName: Gender
                  order: 29
                  type: String

                home_phone:
                  displayName: Home phone
                  order: 18
                  type: String

                internal_integration_user:
                  displayName: Internal Integration User
                  order: 38
                  type: String

                introduction:
                  displayName: Prefix
                  order: 46
                  type: String

                last_login:
                  displayName: Last login
                  order: 20
                  type: String

                last_login_time:
                  displayName: Last login time
                  order: 3
                  type: String

                last_name:
                  displayName: Last name
                  order: 51
                  type: String

                ldap_server:
                  displayName: LDAP server
                  order: 39
                  type: String

                location:
                  displayName: Location
                  order: 59
                  type: String

                locked_out:
                  displayName: Locked out
                  description: When checked, user cannot login
                  order: 49
                  type: String

                manager:
                  displayName: Manager
                  order: 48
                  type: String

                middle_name:
                  displayName: Middle name
                  order: 54
                  type: String

                mobile_phone:
                  displayName: Mobile phone
                  order: 40
                  type: String

                name:
                  displayName: Name
                  order: 26
                  type: String

                notification:
                  displayName: Notification
                  description: Enable or disable notifications for this user ie. email, SMS etc
                  order: 8
                  type: String

                password_needs_reset:
                  displayName: Password needs reset
                  description: User will be prompted to change password at next login
                  order: 28
                  type: String

                phone:
                  displayName: Business phone
                  order: 25
                  type: String

                photo:
                  displayName: Photo
                  order: 52
                  type: String

                preferred_language:
                  displayName: Language
                  order: 47
                  type: String

                roles:
                  displayName: Roles
                  order: 33
                  type: String

                schedule:
                  displayName: Schedule
                  order: 57
                  type: String

                source:
                  displayName: Source
                  order: 4
                  type: String

                state:
                  displayName: State / Province
                  order: 13
                  type: String

                street:
                  displayName: Street
                  order: 41
                  type: String

                sys_class_name:
                  displayName: Class
                  order: 35
                  type: String

                sys_created_by:
                  displayName: Created by
                  order: 16
                  type: String

                sys_created_on:
                  displayName: Created
                  order: 11
                  type: String

                sys_domain:
                  displayName: Domain
                  description: Domain to which the user belongs
                  order: 12
                  type: String

                sys_domain_path:
                  displayName: Domain Path
                  order: 23
                  type: String

                sys_id:
                  displayName: Sys ID
                  order: 36
                  type: String

                sys_mod_count:
                  displayName: Updates
                  order: 50
                  type: String

                sys_tags:
                  displayName: Tags
                  order: 55
                  type: String

                sys_updated_by:
                  displayName: Updated by
                  order: 10
                  type: String

                sys_updated_on:
                  displayName: Updated
                  order: 5
                  type: String

                time_format:
                  displayName: Time format
                  description: Display times with this format (blank means system default)
                  order: 19
                  type: String

                time_zone:
                  displayName: Time zone
                  order: 56
                  type: String

                title:
                  displayName: Title
                  order: 34
                  type: String

                user_name:
                  displayName: User ID
                  order: 32
                  type: String

                user_password:
                  displayName: Password
                  order: 2
                  type: String

                vip:
                  displayName: VIP
                  order: 15
                  type: String

                web_service_access_only:
                  displayName: Web service access only
                  description: Prevent user from accessing UI, and require a SOAP role to make API protocol calls (such as SOAP and WSDL requests)
                  order: 7
                  type: String

                zip:
                  displayName: Zip / Postal code
                  order: 17
                  type: String

      operationId: GetRecords

    - kind: ConditionGroup
      id: conditionGroup_YJKNVj
      conditions:
        - id: conditionItem_myAGBi
          condition: =!IsBlank(Topic.GetServiceNowUser) && !IsEmpty(Topic.GetServiceNowUser.result)
          actions:
            - kind: ParseValue
              id: S8YKdH
              variable: Topic.ServiceNowUserTable
              valueType:
                kind: Record
                properties:
                  result:
                    type:
                      kind: Table
                      properties:
                        active: String
                        avatar: String
                        building: String
                        calendar_integration: String
                        city: String
                        company: String
                        cost_center: String
                        country: String
                        date_format: String
                        default_perspective: String
                        department: String
                        email: String
                        employee_number: String
                        enable_multifactor_authn: String
                        failed_attempts: String
                        fax: String
                        federated_id: String
                        first_name: String
                        gender: String
                        home_phone: String
                        internal_integration_user: String
                        introduction: String
                        last_login: String
                        last_login_time: String
                        last_name: String
                        ldap_server: String
                        location: String
                        locked_out: String
                        manager: String
                        middle_name: String
                        mobile_phone: String
                        name: String
                        notification: String
                        password_needs_reset: String
                        phone: String
                        photo: String
                        preferred_language: String
                        roles: String
                        schedule: String
                        source: String
                        state: String
                        street: String
                        sys_class_name: String
                        sys_created_by: String
                        sys_created_on: String
                        sys_domain: String
                        sys_domain_path: String
                        sys_id: String
                        sys_mod_count: String
                        sys_tags: String
                        sys_updated_by: String
                        sys_updated_on: String
                        time_format: String
                        time_zone: String
                        title: String
                        user_name: String
                        user_password: String
                        vip: String
                        web_service_access_only: String
                        zip: String

              value: =Topic.GetServiceNowUser

            - kind: SetVariable
              id: setVariable_8D8Dqf
              variable: Global.ServiceNowUser
              value: =First(Topic.ServiceNowUserTable.result)

            - kind: ConditionGroup
              id: conditionGroup_wlzjTB
              conditions:
                - id: conditionItem_tSPXy9
                  condition: =!IsBlank(Global.ServiceNowUser.location)
                  actions:
                    - kind: InvokeConnectorAction
                      id: invokeConnectorAction_NDFi90
                      input:
                        binding:
                          sysid: =Global.ServiceNowUser.location
                          tableType: cmn_location

                      output:
                        kind: SingleVariableOutputBinding
                        variable: Global.ServiceNowUserLocation

                      connectionReference: crb50_hrSelfService.shared_service-now.shared-service-now-e874ff4e-674f-4646-85af-62d958aaafe1
                      connectionProperties:
                        mode: Maker

                      dynamicOutputSchema:
                        kind: Record
                        properties:
                          result:
                            order: 0
                            type:
                              kind: Record
                              properties:
                                city:
                                  displayName: City
                                  order: 3
                                  type: String

                                cmn_location_source:
                                  displayName: Location source
                                  description: Discovery source for this location
                                  order: 26
                                  type: String

                                cmn_location_type:
                                  displayName: Location type
                                  order: 2
                                  type: String

                                company:
                                  displayName: Company
                                  order: 16
                                  type: String

                                contact:
                                  displayName: Contact
                                  order: 14
                                  type: String

                                coordinates_retrieved_on:
                                  displayName: Coordinates retrieved on
                                  description: Date and time when the latitide and longitude are populated
                                  order: 32
                                  type: String

                                country:
                                  displayName: Country
                                  order: 0
                                  type: String

                                duplicate:
                                  displayName: Duplicate
                                  description: If true, this location is a duplicate of another existing location record
                                  order: 23
                                  type: String

                                fax_phone:
                                  displayName: Fax phone
                                  order: 28
                                  type: String

                                full_name:
                                  displayName: Full name
                                  description: System maintained field
                                  order: 27
                                  type: String

                                lat_long_error:
                                  displayName: Lat long error
                                  order: 17
                                  type: String

                                latitude:
                                  displayName: Latitude
                                  order: 4
                                  type: String

                                life_cycle_stage:
                                  displayName: Life Cycle Stage
                                  order: 31
                                  type: String

                                life_cycle_stage_status:
                                  displayName: Life Cycle Stage Status
                                  order: 10
                                  type: String

                                longitude:
                                  displayName: Longitude
                                  order: 20
                                  type: String

                                managed_by_group:
                                  displayName: Managed by group
                                  description: User group responsible for managing this location
                                  order: 6
                                  type: String

                                name:
                                  displayName: Name
                                  order: 30
                                  type: String

                                parent:
                                  displayName: Parent
                                  order: 1
                                  type: String

                                phone:
                                  displayName: Phone
                                  order: 29
                                  type: String

                                phone_territory:
                                  displayName: Phone territory
                                  order: 15
                                  type: String

                                primary_location:
                                  displayName: Primary location
                                  description: Original location this location is duplicating
                                  order: 5
                                  type: String

                                state:
                                  displayName: State / Province
                                  order: 18
                                  type: String

                                stock_room:
                                  displayName: Stock room
                                  order: 11
                                  type: String

                                street:
                                  displayName: Street
                                  order: 12
                                  type: String

                                sys_created_by:
                                  displayName: Created by
                                  order: 19
                                  type: String

                                sys_created_on:
                                  displayName: Created
                                  order: 13
                                  type: String

                                sys_id:
                                  displayName: Sys ID
                                  order: 8
                                  type: String

                                sys_mod_count:
                                  displayName: Updates
                                  order: 22
                                  type: String

                                sys_tags:
                                  displayName: Tags
                                  order: 24
                                  type: String

                                sys_updated_by:
                                  displayName: Updated by
                                  order: 9
                                  type: String

                                sys_updated_on:
                                  displayName: Updated
                                  order: 7
                                  type: String

                                time_zone:
                                  displayName: Time zone
                                  order: 25
                                  type: String

                                zip:
                                  displayName: Zip / Postal Code
                                  order: 21
                                  type: String

                      operationId: GetRecord

              elseActions:
                - kind: SendActivity
                  id: sendActivity_pNm46H
                  activity: There was an issue retrieving your location from ServiceNow.

      elseActions:
        - kind: SendActivity
          id: sendActivity_AjSrBA
          activity: There was an issue retrieving your employee details from ServiceNow.

inputType: {}
outputType: {}