When to use this endpoint

Use this for CRM2 layout-backed invoice editing. Use Invoice_getRequestedDetails when widget assembly is not needed.

Authentication and permissions

The request must use a logged-in CRM session or valid signed API credentials and is scoped to that tenant.

Users whose legacy crm_access mask contains bit 64 receive {"error":"no permission to access api"}. No record-owner check is made.

Parameters

ParameterTypeRequiredDescription
id / idsInteger / arrayAs a selectorShared mapped-data selector for one or more active invoices.
fieldsArrayYesMapped field names. Special values include widgetTableInvoice, widgetInvoiceRecurrence, widgetFormField, and the exact legacy mapped identifier appointmentId.

Example request

$rows = FM_api('Invoice_getLayoutDetails', [
	'id' => 981,
	'fields' => ['id', 'num', 'widgetTableInvoice'],
]);

Example response

[
  {
    "id": 981,
    "num": "INV-981",
    "widgetTableInvoice": {"rows": []}
  }
]

Errors and unusual responses

ResponseCondition
{"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: fields"}No field array is supplied.

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 result is always a row array, even for a single id. Added dependency fields are removed before the response, and unknown mapped-field names are silently omitted.
  • Line items come from either storage format. Recurrence and custom-form widgets are assembled from related data. Nominal selections are normalized.
  • For legacy invoices without meta.oldDiscount, the response projects the stored absolute discount as a percentage. This read does not persist the projection or otherwise update the invoice.

See it in Fieldmotion

CRM1

No production CRM1 caller was found; CRM1 assembles invoice editing controls directly.

CRM2

Open an invoice edit dialog from Invoices. The layoutInvoiceUpdate display loads values through this mapped layout endpoint.

Related endpoints