Skip to main content

I’m currently trying to display a Calendar with all Events for a variety of Users.

Since i want to display a dynamic number of users based on some filters, i resorted to having all from the same source. (meaning they all share a color by default). My approach to bypass that was to have a “Colorfield” on the User to which the Event belongs to.

However when trying to access the WhoId.Calendarcolor__c of the Event, it keeps failing, since a Calendarevent links to the “Name” Pseudoobject rather than the User, i can’t access this color by all means.

I tried this post but it seems this is no longer possible or this was only for having a field or not. Does someone have an idea how i could bypass this limitation so every User’s event have a different color while still having a fully dinamic ammount of users?

Yup. WhoId is a polymorphic lookup. You can only get the Name and Id of any record when using a polymorphic lookup. In this case to Lead & Contact. Only the common standard fields between these two objects will show in the model.

Best you can is use a Flow or Apex to capture to get this value into the Event itself.


Hey Pat thanks for the reply.

We against all odds managed to get it done anyway!
Here is how we built a calendar for a huge amount of users with each having a dedicated color in the calendar:

We have a Model based on the userobject (in our case we store the Color for each user as a Field on the User.
Then we have our calendar  based on an eventsmodel with all events for the users we want to display.
Last but not least on the calendar component with the eventsource wich is rendered by the following render snippet:



var field = argumentss0], $ = skuid.$, id = argumentss1].Owner.Id, userModel=skuid.$M("Users"); $.each(userModel.getRows(), function(index, row){ if(row.Id==id){ $(fieldd0]).css("background-color","#"+row.CalendarColor__c); return false; } });<br>


If someone knows a better solution, i’m open for additions.


If you were basing your Calendar coloring off of the Event OwnerId field, rather than the WhoId field, there is an easier way.

You can add a Salesforce Formula Field to Activity Custom Fields object that crosses the polymorphic boundary and grabs the Calendar Color off of the User object. The formula would look something like this:

 Owner:User.CalendarColor__c

Then, in your Skuid Model on the Event object, just request this Custom Field, and use it as the Background Color (which can contain a template rather than a static value)!

Howeverr, this is not possible if you’re trying to grab the CalendarColor__c via the WhoId relationship — Salesforce has NOT yet added the ability to do custom formula fields that grab values across the WhoId or WhatId polymorphic relationship.