Adding Company property does not work

HI,

I've added an attribute "Company" to Box Template HTML but it does not seem to apply.

Any help much appreciated.

Hi @Adam.Bilski,
Judging by your screenshot, you're using the SP list as a data source, is that correct?
The first thing to check here is that you're using the internal column name. Best way to check this is to open the column settings in the list settings and check the end of the URL in your browser:

image

Also, please see that the OrgChart gives you the possible tokens to use based on your list settings. Click on the "field names" button in the upper-right corner of the editor and you'll see this:

If this doesn't help, please do the following:

  1. Try to add the field in the "Design mode" of the Box editor. Does it work this way?
  2. Send us a screenshot of your data source list settings, "Company" column settings a and a screenshot of the resulting Org Chart.

Thanks!

Hello Vladimir,

Thanks for prompt reply i have now figured out way around it.

However i am having additional issue (let me know if i should open new request)

Now that Company field shows and is a valid data source I want to set background colour based on that field.

I used OnBoxRender event as below but does not seem to work.

renderer.onBoxRendered(function(event, box, itemData){
if(itemData["Company"].contains("Leadership Team"))
{
box.$elem.css({
'background-color': '#719949!important',

});

Thanks

Hi @Adam.Bilski ,
Your code looks fine, except for some syntax (not enough closing braces).
Please try this:

renderer.onBoxRendered(function(event, box, itemData){ 
  if(itemData["Company"].contains("Leadership Team")){    
      var color='#719949'
      console.log(itemData['Company'] +": " + color);
     box.$elem.css({
      'background-color': color
    });
  }
});

This will help you debug. When you open the browser console log (F12), you will see the log of the Company names and the according color that satisfy your condition.
In my example below I use the same code for "Department" property:
image

If it's empty, then you condition mught be off. Then please try to console log the Company field without the condition to see if it gets logged corectly.

Hi @v.uspenskii,

That's it! cannot believe I didn't notice that.

Thanks very much for your help with this one.

@Adam.Bilski, good to know, you're welcome!