Field Type of Time?

Hi,

I have a business requirement that needs me to create a field of time type. Imagine Datetime field without the date.

This question has been asked many times on the SugarCRM forums but none of the replies I found provide a complete working solution. The only reply that came close was this one: http://forums.sugarcrm.com/f6/how-creat-custom-field-type-time-46594/

I do see that there is a Time folder with the required scripts in /include/SugarFields/Fields/Time. But I have no ideas on how to activate this field type in Studio, let alone use it.

I have tried creating a datetime field in the Contacts module and then editing the detailviewdefs.php and editviewdefs.php in /custom/modules/Contacts/metadata/ to add ‘type’ => ‘Time’ to the field attribute array. But all that resulted in was a blank output next to the field in the Detail and Edit layouts.

Please help me get the time field type working. I am sure many others will face the same issue.

AK

Just one clarification: by “activate this field type in Studio”, I mean “make this field type available in Studio”. Surely, don’t want people to get lost on the terminology :wink:

Anyone? This is a roadblock.

Will, can you please help with this?

Hi ak,

You would need to create a custom field type of time for this to work, not just edit the viewdefs.

Thanks,

Will.

Hi Will,

Thanks for replying. As I mentioned in the first post, there already exists a field type of time in /include/SugarFields/Fields/Time. But I am not sure how to utilize this field type. Am I missing something?

Regards,
AK

bump

Hi AK,

It seems this is used as the time part of the datetime field. This seems to be incomplete code for what would be a type ‘Time’ field.

Thanks,

Will.

Ah, ok. In that case, would you be so kind to get me started with creating a “Time” field from scratch, please?

EDIT: I imagine this is in the list of most requested features since it’s not present already. Have you or somebody you know happened to work on this for any deployments that Sales Agility did?

Hi AK,

This is not a feature that has been requested by SuiteCRM users but would be a welcome contribution to SuiteCRM(post this in the suggestion box). We are working on a bug fix release(7.0.2) to be released hopefully next week. SuiteCRM 7.1 will be released at the end of January with new features such as social integration.

Thanks,

Will.

Can you tell why you need to create time field& What is the requirment that you can’t use datetime field and customize display value?

Thanks in advance

Did you ever figure out how to add a time field?
We need a time field to use in our workflow conditions. We want certain actions to performed at certain times each day.
A datetime field would not work in this case.

Did you ever figure out how to add a time field?
We need a time field to use in our workflow conditions. We want certain actions to performed at certain times each day.
A datetime field would not work in this case.

Did anyone ever figure this out? We need to capture a time field for reporting purposes and the datetime field doesn’t let us isolate time in 7.10.4

Thanks

I know only one way to add time field to module.

Change MODULE_NAME to real name of your module, PACK_NAME to real name of your package in module builder, FIELD_NAME to real name of your time field.

If you want to add this field to common module:

  1. add TextField to your common module in Studio
  2. add string to custom/Extension/modules/MODULE_NAME/Ext/Vardefs/sugarfield_FIELD_NAME.php
$dictionary['MODULE_NAME']['fields']['FIELD_NAME']['type']='time';
  1. make Fast Repair and Rebuild

If you want to add this field to custom module:

  1. add TextField to your custom module in ModuleBuilder
  2. change ‘type’ attribute from ‘varchar’ to ‘time’ of your field in vardefs.php of you custom module in custom/modulebuilder/packages/PACK_NAME/modules/MODULE_NAME/vardefs.php
  3. Install your package

After this actions I can edit time in this tield.

Hope this helps.

1 Like