Line Color

How Can We Help?

< Back

One of the new features in XMPro Act 2.2.4 is the ability to change the color of Object Group lines. This is done by adding a reference label, with a name containing “LineColor” (eg QL4090LineColor, case sensitive), and setting its value to the hex code for the color you want.

One example use for this is highlighting a user’s tasks, with different colors indicating different levels of urgency. To do this, set up your Object Group as usual. Then:

  1. Add a reference label to your activity, calling it <Activity Code>Line Color, and add it to the Object Group
  2. At the end of your integration code, add some code to check the username in the Object Groups against the username you want to check, and then set the value of your Line Color reference label to the hex value of the color you want. Some sample code can be found below:
ObjectGroup grp = activity.ObjectGroups.NamedItem("<Your Object Group>");

//Go through each line in the Object Group
for(int index = 0; index <= grp.Lines - 1; index++)
{
     //Check the name
     if(activity.GetControlValue("<Name Field>", grp.ID, index).Equals(currentUser.RoleDescription))
     {
          //Set colors depending on urgency
          if(activity.GetControlValue("<Urgency Field>", grp.ID, index).Equals("1"))
          {
               //Set to red
               activity.SetControlValue("<LineColor Field", "#FF000", grp.ID, index);
          }
          else if(activity.GetControlValue("<Urgency Field>", grp.ID, index) .Equals("2"))
          {
               //Set to yellow
               activity.SetControlValue("<LineColor Field", "#FFD800", grp.ID, index);
          }
          else
          {
               //Set to green
               activity.SetControlValue("<LineColor Field", "#B6FF00", grp.ID, index);
          }
     }
}

To find the hex value for a color, you can use this site: https://www.rapidtables.com/web/color/html-color-codes.html

Currently Line Colours do not change upon activity refresh, only upon activity reload. If you are setting up an activity with Quick Actions, you can set the activity to reload after a Quick Action is performed on a row, by adding a label called xxxQuickActionResponse, and setting its value to Reload via code. More information about setting up Quick Actions can be found here.

 

Comments are closed.

This is the legacy version of the XMPro Documentation site. For the latest XMPro documentation, please visit documentation.xmpro.com

X