Forms
Read a form’s stock flag
/a/Form_getUsesStock
Resolve a form’s stock hint as a numeric 0/1 response.
When to use this endpoint
Use when deciding whether to render stock-related job-cost controls. It does not inspect or modify inventory or the job’s consumed-stock rows.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session and is scoped to the authenticated tenant.
The handler performs no form, department, owner, or page-permission check unless the page below says otherwise. CRM navigation may impose additional UI-only access rules.
Outsourced IDs require an active incoming user_links relationship from the source tenant to the authenticated tenant; the read is explicitly routed to that source. Job fallback enforces the actor’s existing Job scope.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Local integer-compatible ID or outsourced token | No | Non-null explicit id takes precedence, including blank/zero. Legacy token o<sourceTenantId>i<formId> requires positive source/form IDs and an active link; the read explicitly routes to the source. |
app_id | Integer-compatible job ID | When id absent | The job must be non-deleted to resolve form_id. Unlike Form_getIsInvoiceable, this endpoint has no job_id alias. Zero or a missing/deleted job ultimately yields uses_stock=0. |
Example request
$result = FM_api('Form_getUsesStock', ['app_id'=>'1088']);
Example response
{"uses_stock":1}
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error":"no ID"} | Both id and app_id absent/null. |
{"error":"you do not have access to that outsourcer"} | No active link from the supplied source tenant. |
{"error":"Unable to read form flag"} | A source-link, form or fallback-job query fails; query failure is not reported as a disabled flag. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Integer-converts the stored column and returns 1 when nonzero, else 0. Missing form, missing/deleted fallback job and null flag yield 0; actual database failures return an error.
- No form archive/type/owner/page restriction is added. Fallback job reads enforce existing Job scope. The flag remains separate from meta.do_not_update_stock_levels and does not authorize an inventory action.
- Outsourced IDs require positive source/form components and an active incoming link, then read using the source tenant’s explicit routing ID. Unlinked or malformed tokens return an error; same-host placement is not an authorization bypass.
- No direct mobile app/m-service caller for this RPC was found. Mobile form definitions arrive through m’s syncDownloads form channel, not this endpoint.
Side effects
- Read-only; no history, cache invalidation, file write, URL fetch or report rendering.
See it in Fieldmotion
CRM1
Open Job Costs: after Job_get, the client requests Form_getUsesStock with id=job.form_id and app_id=job ID, then renders cost/stock controls.
CRM2
No direct Form_getUsesStock caller found. Form settings and job modules use mapped/batched form data instead.
Related endpoints
Form_setUsesStocksets the local hint.Form_getIsInvoiceableis the separate invoice flag lookup.