Would like my events dashlet to display the number of days till an event starts.

Or at least the start date, also order by start date.


In the attached image, I would like to change “Date Created” to “Days Till” or “Start Date”

Any idea on how to do that?

You can go into Studio and change the layout (fields) in the Dashlet.

Studio > Events module > Dashlet

To make the days difference you will need to do it in code… which is harder, and you have to be a PHP developer.

This might help: https://suitecrm.com/forum/suitecrm-7-0-discussion/2788-create-a-custom-module-dashlet

That’s a start, I’ll take a look. I am a PHP developer, just new to SuiteCRM. Just want to do it the right way and not hacky…

Yup, adding start date is not hard.

I’m guessing that I need to write a method somewhere to calculate the number of days between the start date and the current date. That shouldnt be that hard, done that before. Then I guess I’ll need to write a hook to add it to the selectable options? Or is that only available to database columns?

Ok, cool.

There’s some more code details you can grab from here:
https://suitecrm.com/forum/suitecrm-7-0-discussion/15154-is-there-logic-hook-for-detailsview#50990

That is also a view customization, and it does some calculations with dates; but it’s not a dashlet.

That looks to be exactly what I needed, I’ll let you know.

Well I almost have everything working, I got the code to display the days till the event in the detail view and the list view…

However I ran into a problem, which seems to be a bug…

I copied the

modules/FP_events/Dashlets/FP_eventsDashlet

directory over to

custom/modules/FP_events/Dashlets/FP_eventsDashlet

the updates i did to the custom was not coming through… so in an attempt to debug, I place a die(‘NOW’); at the top of:

modules/FP_events/Dashlets/FP_eventsDashlet/FP_eventsDashlet.php
and
custom/modules/FP_events/Dashlets/FP_eventsDashlet/FP_eventsDashlet.php

the script dies if left on both of them, but runs fine if only on the custom… so the custom script is not being called for some reason.

Not everything is customizable through code in SuiteCRM, sometimes you come across a file where it’s not ready for that “custom” folder mechanism.

I searched the code but couldn’t’ find the “require” for that file, so I can’t tell what’s happening.

Maybe if you try this technique you can work it out - anyway, it’s a good technique to learn, it really helps when working with SuiteCRM:

https://pgorod.github.io/Audit-File-Accesses/