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
Salesforce learnerSalesforce learner 

how to displaying Good morning , Good afternoon and good evening depends on the time using formula in screen flow ,salesforce ?

HarshHarsh (Salesforce Developers) 
Hi,
  • You can use the TIMENOW() function in your formula. 
  • The TIMENOW() function returns a value in GMT representing the current time without the date. Use this function instead of the NOW() function if you want the current hour, minute, seconds, or milliseconds. This value is useful for tracking time like work shifts or elapsed time.
  • If you want to include time as part of a string, wrap the Time value in the TEXT() function to convert it to text. For example, if you want to return the current time as text, use:
    "The time is " & TEXT( TIMENOW() )
You can refer to the following Salesforce article 
http://https://help.salesforce.com/s/articleView?id=sf.formula_using_date_datetime.htm&type=5

Please mark it as Best Answer if the above information was helpful.

Thanks.
 
Nishant SoniNishant Soni
Hi,

To display a greeting message based on the time of day using a formula in a Salesforce Screen Flow, you can use a HOUR() formula that checks the current time and generates the appropriate greeting.

Here's an example of how you can set up the formula for each condition:

For "Morning" (00:00:00 to 11:59:59):
IF(
    HOUR({!$Flow.CurrentDateTime}) < 12,
    "Good morning",
    ""
)
For "Afternoon" (12:00:00 to 16:59:59):
IF(
    AND(
        HOUR({!$Flow.CurrentDateTime}) >= 12,
        HOUR({!$Flow.CurrentDateTime}) < 17
    ),
    "Good afternoon",
    ""
)

Thanks,
Nishant
 
Arun Kumar 1141Arun Kumar 1141
Hi Salesforce Learner,

In order to achieve the above, you can add conditions to check the time of day.  You can use the NOW() function combined with formulas to determine if it's morning, afternoon, or evening. For example:
Morning: HOUR(NOW()) < 12
Afternoon: HOUR(NOW()) >= 12 && HOUR(NOW()) < 17
Evening: HOUR(NOW()) >= 17
Hope this helps.
Thanks.
Jacob Wheeler 7Jacob Wheeler 7
Hey thanks for explaining this. I was searching for this. i will surely use it for my website (https://dubailegaltranslators.com/)
Thom de HaanThom de Haan
Hey all, just to be sure, but did any of you managed to make it work with/without the HOUR fucntion? Because I get the following error in my screen flow: ScreenFlow error (https://app.gemoo.com/share/image-annotation/578422807564771328?codeId=MpEWbLx6QVa2J&origin=imageurlgenerator)