function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lemondashlemondash 

Custom Objects and Custom Fields

Hello all,

I hope somebody can help me with this question or point me in the right direction.

I'm a total newbie to SalesForce but am leaning as quickly as I can by at least searching the web first.  But on this time I can’t seem to work out what to do.

Firstly I have created a custom object called "timesheet" in that object I have two custom fields first field is “start time” and the second is “finish time” at the moment I’m currently using date and time but I would like to just have the time there displayed.  Also I would like to have a third custom field to calculate the time difference, is there formula that can do this? I would also like this field to display the length of time in hours and minutes if possible.

 

Thanks in advance.

skodisanaskodisana

Hi,

 

In salesforce you can create a Time data type fields.

Create a StartTime and End Time as two picklist values.

Which have the values as 00:00, 00:30,01:00.........23:30.creat 24 hour time period with 30min gap.

Create a 3rd field as formula to calculate the time difference.

 

Thanks,

Kodisana

 

 

lemondashlemondash

Kodisana,

 

Many thanks for that and if i'm honest i did think of that as an idea.

 

But the users want to be able to input times like this '02:37' or '5:54' so its more to being able to boild it down to the exact minute.

 

Regard Lee

skodisanaskodisana

Hi,

 

In this case create Start Time and End Time as free text fields.

And write a validation rule using REGEX function. Just to makesure that Users entered in 05:30 format.

Thanks,
Kodisana

forcedotcomforcedotcom

Hi lemondash,

 

Could you let us know why you only want to display the hours / minutes? Where would you capture the date (presumably in a seperate field?) It may be that the date/time field could work for you with some sort of validation, trigger etc... sometimes what seems to be the best approach can lead to problems further 'down the road'

lemondashlemondash

Thanks for your suggestions.

 

Well The idea behind it is that it’s a timesheet for department that need to work out how long they spend on a pre specific  job, so I have a date field on there with a formula of "Today()".  So I need “job start time” and “job finish time” an example being 14:46 to 15:13so time spent will be 27 minutes.  So from that they can work out how much time there is spending on working on jobs.

 

Hope that kind of explains what I’m trying to achieve