Breadcrumbs Pattern

Certified Associate Developer

Hello!

I am trying to figure out the best way to manage the Breadcrumbs Pattern, but I can't seem to grasp the way it is intended to be used.

{
  a!localVariables(
    local!currentNodeId: 4,
    /* This variable would normally be retrieved with a rule like rule!getBreadcrumbsForIdentifier(identifier: local!currentNodeId). */
    local!nodes: a!forEach(
      items: enumerate(local!currentNodeId) + 1,
      expression: choose(
        fv!item,
        a!map(name: "Home", identifier: 1),
        a!map(name: "My Documents", identifier: 2),
        a!map(name: "Strategy", identifier: 3),
        a!map(name: "2018 Road Map", identifier: 4)
      )
    ),
    {
      a!richTextDisplayField(
        labelPosition: "COLLAPSED",
        value: {
          a!forEach(
            items: local!nodes,
            expression: if(
              fv!isLast,
              a!richTextItem(text: fv!item.name, style: "STRONG"),
              {
                a!richTextItem(
                  text: fv!item.name,
                  /* The saveInto in this link would run the query or rule necessary to navigate the user to *
                   * the node in the breadcrumbs that they just clicked on.                                  */
                  link: a!dynamicLink(
                    value: fv!item.identifier,
                    saveInto: local!currentNodeId
                  ),
                  linkStyle: "STANDALONE"
                ),
                a!richTextItem(text: "  /  ", color: "SECONDARY")
              }
            )
          )
        }
      )
    }
  )
}

I'm particularly confused by the way we are supposed to redirect the user to other screens and get the identifier. Does it mean that every page needs an identifier? How do I manage this data?

The only application of this pattern I saw uses a CDT called "Breadcrumbs" (without a table) and constants-pointers to objects we are redirecting to, but this way seems not to be as programmatic as it could be.

What would be the best way to solve this?

  Discussion posts and replies are publicly visible