This is a really important message about something. It could be about anything we deem important enough to tell everyone. It might have links to places, but shouldn't have any images or non-text content. Messages shouldn't be longer than two lines on normal sized layouts.
Genesys Cloud Developer CenterGenesys Cloud Developer Center
Browser storage is disabled

Your theme selection will not be remembered when you refresh the page. Please enable browser storage in the Account Switcher above to allow this setting to be remembered.

Removed from toolbox

Lesson 4B - Relative References

Relative references are similar to absolute references except that you do not build a path to the object you're referencing by starting at the root of the flow YAML but rather from the location of the reference itself. Relative references are very useful when you have common / shared YAML.

Relative references start off with either:

Copied
'.'  - tells the Archy processor to use the current location in the YAML
'..' - tells the Archy processor to go up one level in the YAML

Let's take a look at a relative reference in action. In this flow YAML we'll configure a default menu choice using a relative reference.

Copied
inboundCall:
  name: Archy Demo
  defaultLanguage: en-us
  startUpRef: /inboundCall/menus/menu[startingMenu]
  initialGreeting:
    tts: Hello, this is the initial greeting.
  menus:
    - menu:
        name: Main Menu
        audio:
          tts: You are at the Main Menu, press 9 to disconnect.
        refId: startingMenu
        defaultChildMenuRef: ./choices/menuDisconnect[bye]          <-- relative reference
        choices:
          - menuDisconnect:
              name: Hang up
              refId: bye 

As you can see, for the defaultChildMenuRef, since it starts off with '.', you can think of the '.' as telling the Archy parser, "start here and process the path relative to this object which is the 'Main Menu' menu."

This reference is the equivalent of this absolute reference:

Copied
/inboundCall/menus/menu[startingMenu]/choices/menuDisconnect[bye]

Or here is an example of a Jump to Menu action that uses a relative reference to jump back to a main menu that is a parent or a parent menu choice:

Copied
inboundCall:
  name: Default Inbound Call Flow
  defaultLanguage: en-us
  startUpRef: /inboundCall/menus/menu[mainMenu]
  initialGreeting:
    tts: Hello, this is the initial greeting.
  menus:
    - menu:  
        name: Main Menu
        audio:
          tts: You are at the Main Menu, press 9 to disconnect.
        refId: mainMenu        
        choices:
          - menuSubMenu:
              name: my sub-menu
              choices:
                - menuJumpToMenu:
                    name: jump to main menu
                    targetMenuRef: ../../../..        <-- relative reference to mainMenu                                                         

or this reference would walk up the chain back to menus and then use menu[mainMenu] to pick the same menu with the refId of 'mainMenu':

Copied
                    targetMenuRef: ../../../../../menu[mainMenu]                                      

We're showing that so you can see it's possible to use more than just '.' or '..' in a relative reference.


Tutorial Main | Previous Lesson | Next Lesson


Archy - Ver. 2.33.1, generated on January 3, 2025