Skip to main content
venkataharishd0002
May 15, 2021
Question

Need to create a dynamic milestoneField

  • May 15, 2021
  • 2 replies
  • 1 view

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

    2 replies

    danny.verb
    May 15, 2021

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

    harshitb6843
    May 16, 2021

    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