Skip to main content
January 8, 2024
Question

Query on milestone

  • January 8, 2024
  • 4 replies
  • 0 views

hi,

i created interface using milestone. In interface it executes all steps but in process model when i click next/submit buttton flow got stopped.

a!localVariables(
  local!milestonesteps:rule!M_TSA_MilestoneSteps(
    Delivered:ri!OrderTracking['recordType!{6600bb25-98dd-46fe-8391-fbabecac3729}M_TSA Records.fields.{549e9802-7500-4ad2-ab51-144c175dd513}DeliveryStatus']
  ),
  local!Activestep:1,
a!formLayout(
  label: "Order Status",
  contents: {
    a!sectionLayout(
      label: "",
      contents: {
        a!milestoneField(
          label: "",
          labelPosition: "ABOVE",
          steps: local!milestonesteps,
          links: a!startProcessLink(),
          active: local!Activestep,
          color: 
          if(
            isnull(ri!OrderTracking['recordType!{6600bb25-98dd-46fe-8391-fbabecac3729}M_TSA Records.fields.{549e9802-7500-4ad2-ab51-144c175dd513}DeliveryStatus']),
            {},
            if(
              ri!OrderTracking['recordType!{6600bb25-98dd-46fe-8391-fbabecac3729}M_TSA Records.fields.{549e9802-7500-4ad2-ab51-144c175dd513}DeliveryStatus']=true,
              "POSITIVE",
              "NEGATIVE"
              
            )
          )
        ),
        a!sectionLayout(
          label: "",
          contents: {
            rule!M_TSA_Ordered(
              Step: local!Activestep
            ),
            rule!M_TSA_Packed(
              Step: local!Activestep
            ),
            rule!M_TSA_Shipped(
              Step: local!Activestep,
              Delivered: ri!OrderTracking['recordType!{6600bb25-98dd-46fe-8391-fbabecac3729}M_TSA Records.fields.{549e9802-7500-4ad2-ab51-144c175dd513}DeliveryStatus']
            ),
            rule!M_TSA_OrderStatus(
              Delivered: ri!OrderTracking['recordType!{6600bb25-98dd-46fe-8391-fbabecac3729}M_TSA Records.fields.{549e9802-7500-4ad2-ab51-144c175dd513}DeliveryStatus'],
              Step: local!Activestep
            )
          }
        )
      }
    ),
    
  },
  buttons: a!buttonArrayLayout(
    buttons: {
      a!buttonWidget(
        label: if(local!Activestep<3,"Next","Submit"),
        saveInto: {
          if(
            local!Activestep<4,
            a!save(
              local!Activestep,local!Activestep+1
            ),
            {}
           ),
          a!save(ri!Button,local!Activestep+1)
          },
        value: if(local!Activestep<3,"Next","Submit"),
        submit: true,
        style: "SOLID",
        loadingIndicator: true,
        showWhen: local!activestep<4
      ),
       a!buttonWidget(
        label: "Back",
        value: ri!Button,
        saveInto: {
          if(
            local!Activestep>1,
           a!save(
            local!Activestep,local!Activestep-1
          ),
          {}
          ),
          a!save(ri!Button, local!Activestep-1
            )
 
        },
        submit:true(),
        style: "OUTLINE",
        showWhen: local!Activestep>1,
        validate: false
      )
    }
  )
)
)
https://sovq.appian.community/suite/sites/order-status

    4 replies

    stefanhelzle0001
    Brainy
    January 8, 2024

    It is pretty difficult to see what is going on here. Can you help us with some additional information? E.g. your process model, and what your want to achieve.

    Did you enable "submit" on that buttons by intention?

    Quick hint: I made a podcast episode about how to get great answers from the Appian community: appian.rocks/.../

    January 8, 2024

    Thanks for the information.

    davidg426798
    January 8, 2024

    Reading through the SAIL, it looks like you're defining local!Acttivestep to be 1 on load of the interface, and only updating it when the user clicks on a button. There's no call to start a process model, and no query to get the current active step from a process or database. So, like Stefan, I'm struggling to understand what you're wanting the interface to do in relation to a process model, since it doesn't look like there's any connection to one here.

    In general, for a milestone indicator to work, you'd want to query the current status into a local variable and use that to drive the "active" node on the bar. It's rare for the active milestone to change without submitting the page and loading a new interface, so the dynamic logic you've got for advancing/backing up the local!Activestep isn't usually necessary, though I can see the value in doing that to prove that your milestone bar can properly show all of the statuses as active.

    Hope that helps!

    harshitb6843
    January 9, 2024

    In your code, on line 68, you need to add a similar condition like line 67 where if the active step is less than 3, then the submit should be false and if it is equal to 3, it should be true.