Start from the saved table
When the requested formula belongs to a visible row, column, or cell, inspect the saved Table Block and useedit_table_blocks to target the actual result. The server derives the applicable formula range from the selected visible target.
You do not need to invent or fetch a formula-range ID for a visible edit.
Date scope is required
A rule for Actuals or Forecast needs Date in its condition at the Model’s base grain. For a monthly Model:edit_variables with action: "set_values", the Date-aware condition, and period: "actuals" or period: "forecast".
Read Last close when it matters
Useinspect_dimensions to inspect the Date Dimension and its time settings when you need to confirm Last close. The boundary affects which dates count as Actuals and which belong to Forecast.
If Last close is missing, explain the missing workspace setting before trying to build a range-dependent result.