I renamed Task module to Job Cards.
Announcement
Collapse
No announcement yet.
Help needed with calendar events / tasks with colors depending on the status
Collapse
X
-
try this code below
PHP Code:if(entity\isAttributeChanged('status')) {
if(status == "Not Started") {entity\setAttribute('cColor', '#6fa8d6');}
if(status == "Started") {entity\setAttribute('cColor', '#5cb85c');}
if(status == "Completed") {entity\setAttribute('cColor', '#f0ad4e');}
if(status == "Canceled") {entity\setAttribute('cColor', '#d9534f');}
if(status == "Deferred") {entity\setAttribute('cColor', '#5bc0de');}
}
THIS WILL NOT WORK. THE CUSTOM FIELD MUST BE NAME 'color' NOT 'cColor'Last edited by rabii; 06-22-2024, 01:20 PM.Rabii
Web Dev
- Likes 1
Comment
-
Hi Rabii,
I've tried the above code - no luck. Thanks so much for your assistance though!
Just to confirm - the formula is to create different colored tasks in my calender - based on the status of the task.
In other words - if I have a "status" called "job" or "request for quote" for example, they must display as different colored tasks in the calendar.
What is the purpose of the "varchar" named "color"? Maybe if I understand the purpose I can figure out another way to do this? When I create a new task, it still gives me the options "danger" etc. What if I change these (danger/success/warning etc.) to different colors?Last edited by Iphahla; 06-22-2024, 06:15 AM.
-
Hi,
This should work however it seems you are using the latest version of espocrm which add a prefix of letter 'c' to custom fields.
in order for this to work on any event entity, you should add a field called (color) a varchar that reflects the colors on the calendar. However since you are using the latest version you custom field is called (cColor) that is why the system can't map the field to the color of the calendar. You need to disable this prefix option or you can just create a varchar in metadata called (color) and that should work fine.
Comment