Whatever message this page gives is out now! Go check it out!

thenRun

Last update:
May 18, 2026
After this Future completes normally, runs a parameterless action on the completing thread.

Description

thenRun is an instance method on a CFML Future. When the prior stage completes successfully, your action runs on the completing thread. The action takes no arguments and is used for side effects such as logging or flags. The method returns a new Future for chaining.
This is the synchronous counterpart to thenRunAsync.

Returns

A new Future.

Category

Asynchronous programming

Function syntax

future.thenRun(action)

Parameters

ParameterDescription
actionRequired. A function with no parameters that performs work (void semantics).

Example

Set a variable after the first stage completes.

<cfscript>
    runAsync(function() { return 1; })
    .thenRun(function() { variables.flag = true; })
    .get();
    writeOutput(variables.flag); // true
</cfscript>
      

See also

thenAccept

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page