3

I use the "Get Records" element to retrieve an object and select "Choose fields and let Salesforce do the rest" to save a field of type Time on this record. (I've tried "Choose fields and assign variables (advanced)" as well - saving the time field into a text variable. The flow can be saved, but produces an "Unfortunately, there was a problem. Please try again..." and can't even be debugged.)

Based on this time, I would like to overwrite the time part of a DateTime field of another record. DateTimes can be adjusted with texts, e.g. by

DATETIMEVALUE(TEXT(DATEVALUE({!Start_Date_1})) & " 22:22:22")

(I'm aware of the dangers of time zones in this context.)

But how can I convert the Time field to a text? The formula

TEXT(MyTime__c)

works as a definition of a formula field of an object and returns something like 08:00:00.000. Trying to save a similar formula in a flow

"My time "&TEXT({!Get_My_Time.MyTime__c})

, Salesforce has an issue:

The formula expression is invalid: Incorrect parameter type for function 'TEXT()'. Expected Number, Date, DateTime, Picklist, received Text

Indeed I can store times as texts in text formulas without an issue:

"My time "&{!Get_My_Time.MyTime__c}

But according to the flow debugger, this returns null throughout.

So is the workaround to use the formula field on the object and refer to this in the flow? Or what have I missed?

1 Answer 1

4

The reason for the weirdness is that the Time field type is not supported in Flow Builder

Time Custom Field outlines its limitations

Be aware of the following limitations when using a time field type. The time field:

  • Isn’t supported in Flow Builder, Process Builder, and Schema Builder.
  • Doesn't support the creation of custom index for SOQL queries.
  • Isn’t available for standard lookup relationships in external objects.

Interestingly, another thing to note is that TEXT() doesn't even mention time explicitly as something it can convert

Converts a percent, number, date, date/time, or currency type field into text anywhere formulas are used. Also, converts picklist values to text in approval rules, approval step rules, workflow rules, escalation rules, assignment rules, auto-response rules, validation rules, formula fields, field updates, and custom buttons and links.

Yet, there's examples of TEXT() working and referenced in other docs - Converting Between Time and Text.

As such, based on Flow not supporting it, your only workaround is what you mentioned - creating a custom formula field on the object that will support time field and provide Flow with the output.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .