Jobs: lookups and details
Check a job’s contract invoicing flag
/a/Job_getContractInvoiceable
Read the linked contract’s not_invoiceable flag before showing job invoice or cost controls.
When to use this endpoint
Read the linked contract’s not_invoiceable flag before showing job invoice or cost controls.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. These calls use the authenticated account’s data; the handler has no additional job-page, department, assignee or client-admin permission check unless stated below.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Job ID, converted with intval; the result must be positive. This selects a physical job ID, not an app ID or job reference. |
Example request
$result = FM_api('Job_getContractInvoiceable', ['id' => '1042']);
Example response
{"id":"1088","meta":"{\"not_invoiceable\":1}","not_invoiceable":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":"missing or invalid parameter: id"} | Invalid ID; checked before login. |
{"not_invoiceable":0,"error":"job or contract does not exist"} | No active job with a matching contract row is found, or the query fails. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- The returned id is the contract ID, not the job ID. meta remains an encoded JSON string; not_invoiceable is separately copied from decoded metadata, without boolean/numeric normalization.
- Missing not_invoiceable defaults to integer 0. The error response also includes 0: test error before treating the contract as invoiceable.
- The job must be active, but the contract query has no deleted/status/date predicate. This is a UI eligibility hint, not an authorization or invoice-generation check.
See it in Fieldmotion
CRM1
Open a job’s Invoice, Costs, Form or Files view. The page or widgetInvoiceTable calls Job_getContractInvoiceable with the job ID to decide whether invoice-related controls should be shown.
CRM2
Open a job’s Invoice view. pageJobInvoice.js requests Job_getContractInvoiceable alongside tax settings; filter that request in browser developer tools.
Related endpoints
Job_invoiceGetreads an existing invoice or returns an unsaved empty invoice object.Job_getDefaultTaxSettingsresolves defaults when invoice editing is available.