The problem
The same business rule, such as a due-date calculation, a status rule or a price, ends up written twice: once as a Quickbase formula and again in JavaScript or PHP for an integration. The two drift apart, and nobody knows which one is right.
The fix: run the formula through the API
The RESTful API has a Run a formula endpoint (POST /v1/formula/run). You send a JSON body with:
formula: any valid Quickbase formulafrom: the table IDrid(optional): a record ID, for formulas that reference a record’s fields. Formulas likeUser()don’t need one.
It returns the formula’s result, without needing a field on the table.
const res = await fetch('https://api.quickbase.com/v1/formula/run', {
method: 'POST',
headers: {
'QB-Realm-Hostname': 'yourcompany.quickbase.com',
'Authorization': `QB-USER-TOKEN ${token}`, // or QB-TEMP-TOKEN in a code page
'Content-Type': 'application/json',
},
body: JSON.stringify({
from: 'bxxxxxxxx',
rid: 1042,
formula: 'WeekdayAdd([Start Date], [Duration Days])',
}),
});
const { result } = await res.json();
Good uses
- One source of truth for rules: calculate due dates, statuses or eligibility in Quickbase’s formula language, and call it from code.
- Testing formulas against specific records from a script before saving them in a field.
- Code pages that need a calculated value without adding yet another formula field to the table.
Gotchas
- It’s still an API call, so it counts toward rate limits. Don’t call it in a tight loop over thousands of records; batch the logic or store results instead.
- Permissions apply. The formula runs as the token’s user and only sees what that user can see.
- Formula queries cost the same here as in a field, so the formula query performance rules still apply.