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
imishraimishra 

Single field with multiple drop down

Hi,

 

I need to create a field Timeslot and it should have dropdown of hour(0-24), minute and am/pm.

Can anyone please tell me how to do this.

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
Scott_VSScott_VS

This forumla worked for me:

 

TEXT( Hours__c ) + ':' + TEXT( Minutes__c ) + ' ' + TEXT( AM_PM__c )

 Are Hours__c and Minutes__c picklists?

All Answers

Scott_VSScott_VS

There isn't any native way to do this. You will need to consider a workaround. Some suggestions that I can think of:

  • Create a inline visualforce page with the three dropdowns and add it to the page layout.
  • Make it a text field instead and set the field's validation rules to only accept time values.

Hope this helps!

imishraimishra

Thanks for the reply.

 

Is it possible to create a group including 2 fields?

 

 

imishraimishra

I created a formula(Text) field to populate the hrs and mins from the picklist value, but it is not displaying in time format.

 

Can u please help me with the formula.Below is the formula which i have written:

 

TEXT( Hours__c  ) &  TEXT( Minutes__c ) & TEXT( AM_PM__c )

 

I tries tried using Date/Time also, but it is displaying like #ERROR.

 

 

Thanks.

Scott_VSScott_VS

This forumla worked for me:

 

TEXT( Hours__c ) + ':' + TEXT( Minutes__c ) + ' ' + TEXT( AM_PM__c )

 Are Hours__c and Minutes__c picklists?

This was selected as the best answer
imishraimishra

Hi,

 

Yes Hours and Minutes are Picklists.

 

 

imishraimishra

It works fine.

Thanks for the solution.