Announcement

Collapse
No announcement yet.

Help needed with calendar events / tasks with colors depending on the status

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help needed with calendar events / tasks with colors depending on the status

    Hi EspoCrm lovers,

    I am trying to find some advise or guidance for the following challenge.

    On my EspoCrm I am using a lot the calendar option and events to have an internal booking system. The platform provides me almost all the details I need, and this was one of the main points I opted for EspoCrm. The possibility to edit the events / tasks on the calendar.
    However I came to the situation where I would need to have the events / tasks being able to be colored like the Kanban Views.

    The case is that I have the following options for the events / tasks ( Planned, Confirmed, On Hold, Canceled, Completed).
    It would be amazing to see them on the calendar with specific colors for each event / tasks.


    Please see attached pictures with my Kanban View and my calendar view, to give a better idea of my need.

    Thank you

  • #2
    Espo use fullCalendar v. 3 (https://fullcalendar.io/docs/v3/event-object)

    As I see in source code you can pass event color.

    Attached Files

    Comment


    • #3
      Simple experiment with returning color
      Attached Files

      Comment


      • #4
        Originally posted by dimyy View Post
        Simple experiment with returning color
        Hi dimyy,
        Thank you for answering my question.
        I will try this one out troughout the weekend and leave a feedback.

        This looks promising

        Comment


        • #5
          1. Create a new varchar field for Task with the name 'color'.
          2. Write formula that sets a HEX value to the 'color' attribute, depending on the 'status'.

          Comment


          • #6
            Originally posted by yuri View Post
            1. Create a new varchar field for Task with the name 'color'.
            2. Write formula that sets a HEX value to the 'color' attribute, depending on the 'status'.
            Hi Yuri,

            Do you have an example of that formula? I am newbie eager to learn some more.

            Thank you

            Comment


            • #7
              Hi geonaute

              Formula should something like below, when a task status is changed then we need to update the color field:

              Code:
              ifThen(entity\isAttributeChanged('status'),
              ifThen(status === "Not Started", entity\setAttribute('color', '#6fa8d6'));
              ifThen(status === "Started", entity\setAttribute('color', '#edc555'));
              ifThen(status === "Completed", entity\setAttribute('color', '#7cc4a4'));
              ifThen(status === "Cancelled", entity\setAttribute('color', '#ed8f42'));
              ifThen(status === "Deferred", entity\setAttribute('color', '#d4729b'));
              )
              Hope this helps

              Comment


              • #8
                Originally posted by rabii View Post
                Hi geonaute

                Formula should something like below, when a task status is changed then we need to update the color field:

                Code:
                ifThen(entity\isAttributeChanged('status'),
                ifThen(status === "Not Started", entity\setAttribute('color', '#6fa8d6'));
                ifThen(status === "Started", entity\setAttribute('color', '#edc555'));
                ifThen(status === "Completed", entity\setAttribute('color', '#7cc4a4'));
                ifThen(status === "Cancelled", entity\setAttribute('color', '#ed8f42'));
                ifThen(status === "Deferred", entity\setAttribute('color', '#d4729b'));
                )
                Hope this helps
                Hi Rabii, Thank you for your assistance regarding my challenge with the calendar.

                I have tried to make the steps advised by Yuri and you but I did not have any sucess.

                I am missing something in here.

                1- I created the new varchar field for my "event" with the name color. (Please see picture attached.

                2-- I wrote on the formula field your formula, but when entering the calendar, nothing changed.

                Any ideas which step I am doing wrong?

                Thanks

                Comment


                • rabii
                  rabii commented
                  Editing a comment
                  I noticed that you have an entity called Booking, is it an event type entity ?

                  If yes, please note that new event Entities will only have a status with values [ Planned, Held, Not Held], so in this case the code should be:

                  Code:
                  ifThen(entity\isAttributeChanged('status'),
                  ifThen(status === "Planned", entity\setAttribute('color', '#6fa8d6'));
                  ifThen(status === "Held", entity\setAttribute('color', '#7cc4a4'));
                  ifThen(status === "Not Held", entity\setAttribute('color', '#ed8f42'));
                  )
                  if you wish you can extend the values in status and add more status and just update the formula to update color based on new values.

                  try this code on the Booking formula and just try to update the status and it should work. you are just missing the correct values of the status field of your booking entity. you can share your progress and we are happy to help.

                • rabii
                  rabii commented
                  Editing a comment
                  Just seen your first post pictures and it seems that your status has (Planned, Confirmed, On Hold, Canceled, Completed), therefore please use the formula below:

                  Code:
                  ifThen(entity\isAttributeChanged('status'),
                  ifThen(status === "Planned", entity\setAttribute('color', '#337ab7'));
                  ifThen(status === "Confirmed", entity\setAttribute('color', '#5cb85c'));
                  ifThen(status === "On Hold", entity\setAttribute('color', '#f0ad4e'));
                  ifThen(status === "Canceled", entity\setAttribute('color', '#d9534f'));
                  ifThen(status === "Completed", entity\setAttribute('color', '#5bc0de'));
                  )
                  Remember that this code will be executed once the status field has changed, so if you want to try it out you need to update some events's status field to reflect the changes in the calendar.

                  Good luck

              • #9
                Did you create new events? This should apply to new events, not existing ones, as the formula script runs only when create/edit records.

                You can run re-calculate formula from the list view > select all results > actions to apply the script for all records.

                Comment


                • #10
                  Originally posted by yuri View Post
                  Did you create new events? This should apply to new events, not existing ones, as the formula script runs only when create/edit records.

                  You can run re-calculate formula from the list view > select all results > actions to apply the script for all records.
                  Hi Yuri,

                  Thank you again for your help on this one.

                  I am almost sure that I am missing something from my side.
                  Basically I ested to create a new entrie and still only shows green.

                  Regarding your suggestion, " you can run re-calculate formula from the list view > select all results > actions to apply the script for all records. " I have no idea where to find this List view. Newbie here.

                  Still learning Espo on the go as needed.

                  Looking forward for some guidance.

                  Thank you so much for all the assistance


                  Comment


                  • #11
                    Originally posted by geonaute View Post

                    Hi Rabii, Thank you for your assistance regarding my challenge with the calendar.

                    I have tried to make the steps advised by Yuri and you but I did not have any sucess.

                    I am missing something in here.

                    1- I created the new varchar field for my "event" with the name color. (Please see picture attached.

                    2-- I wrote on the formula field your formula, but when entering the calendar, nothing changed.

                    Any ideas which step I am doing wrong?

                    Thanks
                    Hi rabil,

                    Thank you for your comments, I almost missed them in the forum.
                    I have been banging my head against the wall to try to fix this one.

                    When adjusting the quote as suggested by you, I tried to verify it and it is giving a syntax error. Already tried to review it several times with no sucess.

                    Please see attached picture. And also my "Status field" details.

                    The code:

                    ifThen(entity\isAttributeChanged('status'),
                    ifThen(status === "Planned", entity\setAttribute('color', '#6fa8d6'));
                    ifThen(status === "Confirmed", entity\setAttribute('color', '#5cb85c'));
                    ifThen(status === "On Hold", entity\setAttribute('color', '#f0ad4e'));
                    ifThen(status === "Canceled", entity\setAttribute('color', '#d9534f'));
                    ifThen(status === "Completed", entity\setAttribute('color', '#5bc0de'));
                    )



                    Thanks again for the amazing support.
                    Last edited by geonaute; 04-24-2022, 05:45 AM.

                    Comment


                    • #12
                      Use == instead of ===. === not supported in formula.

                      Comment


                      • #13
                        Originally posted by yuri View Post
                        Use == instead of ===. === not supported in formula.
                        Thank you so much Yuri, rabil and all that lost time to assist me.

                        It is working now at 100%. Amazing!!!

                        Thank you for all the support.

                        Comment

                        Working...
                        X