Loading

Formula Field Returns Null and DATEVALUE() Returns Wrong Date in Field Service Mobile Flows

Veröffentlichungsdatum: Aug 28, 2026
Beschreibung

When technicians use a Salesforce Flow within the Salesforce Field Service (FSL) Mobile app, two related platform behaviors may be observed.

Behavior 1: Formula Field Returns Null Within the Same Salesforce Flow Transaction

A formula field — for example, EndDate__c defined as DATEVALUE(End_Date__c) — returns null when a Flow reads it after updating the source DateTime field (End_Date__c) within the same execution. The record has not yet been committed to the database at the point the formula field is evaluated, so the formula cannot recalculate against the new value.
This behavior occurs regardless of whether the Flow is launched from Salesforce Field Service (FSL) Mobile or the Salesforce web application. It is not a Field Service Mobile limitation — it is standard Salesforce platform behavior.

Behavior 2: DATEVALUE() Returns a Date One Day Earlier Than Expected for UTC+ Time Zone Users

When a Salesforce Flow Formula Resource uses DATEVALUE() to convert a DateTime value to a Date, Salesforce evaluates the formula using GMT/UTC (Greenwich Mean Time / Coordinated Universal Time). For users in time zones ahead of UTC — such as IST (India Standard Time, UTC+5:30) or AEST (Australian Eastern Standard Time, UTC+10) — the resulting date may appear one day earlier than expected. This happens because the UTC representation of a local afternoon time falls on the previous calendar day in UTC.

Example:
A technician in IST records a completion time of 10:00 PM on July 22 IST. In UTC, this is 4:30 PM on July 22 UTC — so DATEVALUE() returns July 22 correctly. However, a time of 1:00 AM on July 22 IST converts to 7:30 PM on July 21 UTC, and DATEVALUE() returns July 21, which is one day earlier than the technician's local date.

Note:
After any server-side automation runs (such as Flows, triggers, or integrations), technicians should perform a Pull-to-Refresh (pull the screen downward) in the FSL Mobile app. This ensures the app displays the latest server-committed values before launching a Flow that depends on them.

Lösung

This article provides resolution steps for two distinct behaviors observed when using Salesforce Flows with formula fields and the DATEVALUE() function, particularly within the Salesforce Field Service (FSL) Mobile app. Behavior 1 is addressed by restructuring the Flow to avoid formula field references within the same transaction. Behavior 2 is addressed by adjusting how date conversion is performed for users in time zones ahead of UTC (Coordinated Universal Time). Both behaviors can occur in standard Salesforce web application Flows as well — they are not exclusive to FSL Mobile.

Fix Behavior 1: Avoid Referencing Formula Fields in the Same Salesforce Flow Transaction

Option A: Use a Flow Formula Resource

Instead of referencing the stored formula field (EndDate__c), create a Flow Formula Resource that computes the same value inline. This avoids the dependency on the database-committed formula field value.
Configure the Flow Formula Resource as follows:

  • Variable name: varEndDate
  • Formula: DATEVALUE({!varEndDateTime})

Note: This workaround also applies the DATEVALUE() UTC offset described in Behavior 2. See the "Fix Behavior 2" section below for handling the time zone offset if your users are in time zones ahead of UTC.

Option B: Use a Completely New, Separate Flow

Create a completely separate, new Flow to read the formula field value. The first Flow handles the DateTime field update and completes its transaction, which commits the record to the database and allows the formula field to recalculate. A second, independent Flow is then triggered (for example, via a Record-Triggered Flow on the same object, or by manual launch) to read the formula field value after it has been committed.

Using a subflow call, a separate screen element, or a Get Records element within the same Flow does not resolve this issue — all elements within a single Flow execution share the same transaction context. Only a completely new Flow execution, after the first Flow has fully committed, will read the recalculated formula field value correctly.

Fix Behavior 2: Handle DATEVALUE() UTC Offset for UTC+ Time Zone Users (Salesforce Web Application Only)

When using DATEVALUE() in a Flow Formula Resource and users are in time zones ahead of UTC, the standard DATEVALUE() function does not account for the user's local time zone.

Important limitation:
Apex Invocable Actions are not supported in the Salesforce Field Service (FSL) Mobile app. The Apex-based workaround described below applies only to Salesforce web application Flows. For FSL Mobile, the recommended approach is to avoid relying on DATEVALUE() for UTC+ users and instead store and use the DateTime value directly in the Flow, or raise a product feedback request via the Salesforce Idea Exchange (see Additional Resources).

For Salesforce web application Flows, the Apex Invocable Action approach uses the UserInfo.getTimeZone() method to access the running user's time zone and returns a Date value that correctly reflects the user's local date.
To implement this solution in a web application Flow, create a new Apex class in your Salesforce org using the code below, then add an Apex Action element in your Flow and reference this Invocable Action. The Flow passes the DateTime value to the action, and the action returns the correctly converted Date. This approach does not work in FSL Mobile Flows.

@InvocableMethod(label='Convert DateTime to User Local Date')
public static List<Date> convertToLocalDate(List<Datetime> dateTimes) {
TimeZone tz = UserInfo.getTimeZone();
List<Date> results = new List<Date>();
for (Datetime dt : dateTimes) {
results.add(Date.newInstance(
dt.year(), dt.month(), dt.day()
));
}
return results;
}

FSL Mobile limitation: Because Apex Invocable Actions are not supported in FSL Mobile Flows, this fix cannot be applied to the mobile context. Customers experiencing Behavior 2 in FSL Mobile should be advised to use the DateTime value directly where possible, and to submit product feedback via the Salesforce Idea Exchange to request native time zone-aware date conversion support in FSL Mobile Flows.

Nummer des Knowledge-Artikels

005389426

 
Laden
Salesforce Help | Article