Addi different tag background on condition

Certified Associate Developer

Hello, 

I have questions regarding tags background, 

Let's assume I have different statuses written with text in the DB

backgroundColor:
if (rule!BBO_CaseStatusToText(rf!status) = "Open Status","SECONDARY","POSITIVE")
)

Let's assume that I have more than 2 statues

Open Status

Pending Status

Closed Status

How I can create multiple if conditions or case switch where I can made the evaluation depending on the status provides show me different background.

Any help will be appreciated.

Thank you. 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    if(
                    fv!row['recordType!{0f38087c-3fac-4414-a181-694ccda3115e}Sales Order.fields.{status}status']=cons!ECOC_STATUSES[1],
                    a!tagField(
                      tags: a!tagItem(
                        text: "Active",
                        backgroundColor: "POSITIVE"
                      ),
                      size:"SMALL",
                      align: "CENTER"
                    ),
                    if(
                      fv!row['recordType!{0f38087c-3fac-4414-a181-694ccda3115e}Sales Order.fields.{status}status']=cons!ECOC_STATUSES[2],
                      a!tagField(
                        tags: a!tagItem(
                          text:"Closed",
                          backgroundColor: "NEGATIVE"
                        ),
                        size:"SMALL",
                        align: "CENTER"
                      ),
                      a!tagField(
                        tags: a!tagItem(
                          text: "Cancelled",
                          backgroundColor: "SECONDARY"
                        ),
                        size:"SMALL",
                        align: "CENTER"
                      )
                    )
                  )

    I think this code is helpful if we want to display more than 2 Tags.

Reply
  • 0
    Certified Senior Developer

    if(
                    fv!row['recordType!{0f38087c-3fac-4414-a181-694ccda3115e}Sales Order.fields.{status}status']=cons!ECOC_STATUSES[1],
                    a!tagField(
                      tags: a!tagItem(
                        text: "Active",
                        backgroundColor: "POSITIVE"
                      ),
                      size:"SMALL",
                      align: "CENTER"
                    ),
                    if(
                      fv!row['recordType!{0f38087c-3fac-4414-a181-694ccda3115e}Sales Order.fields.{status}status']=cons!ECOC_STATUSES[2],
                      a!tagField(
                        tags: a!tagItem(
                          text:"Closed",
                          backgroundColor: "NEGATIVE"
                        ),
                        size:"SMALL",
                        align: "CENTER"
                      ),
                      a!tagField(
                        tags: a!tagItem(
                          text: "Cancelled",
                          backgroundColor: "SECONDARY"
                        ),
                        size:"SMALL",
                        align: "CENTER"
                      )
                    )
                  )

    I think this code is helpful if we want to display more than 2 Tags.

Children
No Data