Date in custom module

Guys,

This is the “fourth” time I’m trying to post this question. Can someone at least revert to me if it isn’t being posted and tell me what is wrong with this please?

I have created a custom module with an iframe that links to an internal SSRS website. I can pass parameters to the site and update the URL.

Ideally what I would like is for a user to click into the module and for the site to take today’s date as an end date and the 1st of the month (whatever month we happen to be in) as a start date. I can pass in dates that the user selects from the calendar that’s built into SuiteCRM, buy I would like it to automatically, dynamically update dates on the fly as it were.

So, a user clicks into the module, the start date is set to the 1st of the month, and the end date is set to today, these are passed into the URL and the reports site updates…

That’s what I want to happen. Is this possible? Where do I goo to make this happen, and how do I do it.

I’m completely new to any CRM product, but I have to try to get this working as a POC.

All help is appreciated,

Lars

Hi sorry about all those lost posts - they’re showing now, but they were probably delayed because I hadn’t seen them before and I guess I keep track of every post here :slight_smile:

Check out this thread, see if you can come up with a solution from that:

https://www.suitecrm.com/forum/suitecrm-7-0-discussion/16297-iframe-field-how-to-embed-externale-web-page-with-context

The first step is to get the data flowing from a field into the iframe; then we can work on overriding the view so you can set the value you actually want.

This should help you with the second part:

https://suitecrm.com/forum/suitecrm-7-0-discussion/15154-is-there-logic-hook-for-detailsview

It’s just an example, but it let’s you add code to the screen being displayed, so you can put something in a field and then that get’s sent to the iframe URL.

Don’t forget to come back here and share your solution when you have one! Thanks

Hi Guys,

I’m still grappling with the date options drop down as a first step to getting what I need. The date field provides certains option straight out of the box. See DateOptions).

I’ve edited the Modules/DynamicFields/templates/Fields/TemplateDate.php file to include an entry

“$app_strings[‘LBL_FIRST_DAY_OF_CURRENT_MONTH’]=>‘first day of current month’, //bespoke entry to handle 1st day of current month”

but when I go to add the field in Studio the space is there for it( but there’s nothing showing(see DateOptionAfter)…fourth from the bottom
Where do I have to edit this so that my edit appears in the list? What file or dropdown?

Thanks,

Lars

You have to use the “code” tags here on the forums when you post code, otherwise the brackets don’t show…

Sorry about that. Won’t happen again

You will have to define a LBL for that. For your example in /modules/DynamicFields/language/en_us.lang.php

add a new entry to that array e.g.

 'LBL_FIRST_DAY_OF_THE_MONTH'=>'First day of the Month',

Now add this to your dateStrings array in TemplateDate.php

$app_strings['LBL_FIRST_DAY_OF_THE_MONTH']=> date('01-m-Y') ,

Save and do a repair and rebuild.

2 Likes