Need to create a dynamic milestoneField

Hi Team,

I'm having a requirement to make the below milestone object to Dynamic. 

Here 

Not Assigned, InProgress, Completed are fetching from one table and Review, Rejected are fetching from another table.

The milestone object should be like below. Please help me 

Thanks in advance

  Discussion posts and replies are publicly visible

  • I'm not sure exactly what would cause the list to change but here is an example where you can swap out the options

    a!localVariables(
      local!isTrue: true,
      local!stepsOne: {"Not Assigned", "In Progress", "Completed"},
      local!stepsTwo: {"Not Assigned", "In Progress", "Review", "Rejected", "Completed"},
      {
        a!linkField(
          links: {
            a!dynamicLink(
              label: "Flip",
              value: not(local!isTrue),
              saveInto: local!isTrue
            )
          }
        ),
        a!milestoneField(
          label: "Milestone",
          labelPosition: "ABOVE",
          steps: if(
            local!isTrue,
            local!stepsOne,
            local!stepsTwo
          ),
          links: {},
          active: 1
        )
      }
    )
    

  • Hi Harris,

    Please try the code snippet provided below and you should be able to generate what you are trying to do.

    a!localVariables(
      local!stepsFromTable1: rule!getStepsFromTable().data,
      local!stepsFromTable2: rule!getStepsFromAnotherTable().data,
      local!milstoneSteps: a!forEach(
            items: {
                local!stepsFromTable1.label,
                local!stepsFromTable2.label
            },
            expression: {
                stepId: fv!index,
                stepName: fv!item
            }
        ),
      local!activeStep: 1,
      {
        a!milestoneField(
          label: "Milestone",
          labelPosition: "ABOVE",
          steps: local!milstoneSteps.stepName,
          links: {},
          active: local!activeStep
        )
      }
    )

    What I have tried to do here is get the data from two different tables and combine them in one dictionary. That way, each step has a unique if, and then you can refer to that dictionary any time if you want to see what is the name of the active step.

    Thanks,
    Harshit