Reporting dashboards and targets
Replace one widget layout
/a/ReportDashboard_setGrid
Replace one widget’s layout using an actual object/array rather than JSON text.
When to use this endpoint
Load the saved dashboard/group configuration first, then send this edit from its settings or layout controls. Re-read the configuration after an uncertain write: the handler reports validation, permission, lookup, and write failures as application errors.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. All lookups and writes are tenant-local.
The group owner or an effective edit-share recipient may create/edit/delete widgets or save layout/date filters. A view share alone is read-only. None disables its share array; otherwise string user IDs or All grant that share. No reporting-feature or additional CRM2 page-role check is applied.
For signed form requests, sign numeric scalar values as strings, including values inside native nested arrays. Send JSON text only for parameters explicitly accepting JSON strings; see Getting started.
These reporting handlers require tenant schema upgrade 794 before deployment. No request path creates or repairs schema.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | Positive integer ID in the authenticated tenant. Malformed, fractional, zero, or negative values are rejected; deleted records are unavailable. |
val | Native array/object-shaped form fields | Yes | Layout fields, commonly x/y/w/h. Top-level content is removed before JSON encoding; no coordinate/size validation. |
Example request
$result = FM_api('ReportDashboard_setGrid', ['id'=> '71','val'=>['x'=> '0','y'=> '0','w'=> '6','h'=> '4']]);
Example response
{"ok":"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"} | Required id is absent or invalid. |
{"error":"missing or invalid parameter: val"} | Required val is absent or invalid. |
{"error":"no permission to access api"} | The group is not readable/editable, or the operation requires ownership and the caller is not its owner. |
{"error":"reporting write failed"} | A database write failed. Transactional operations roll back instead of returning success. |
{"error":"report is not existing."} | The widget is missing or deleted. |
{"ok":"1","warning":"no change required"} | Normalized input equals the stored value; no write occurs. |
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 native layout array is JSON-encoded after removing top-level content. No coordinate/size constraints are applied.
- JSON is saved with a bound parameter; quotes and backslashes do not corrupt the SQL query. JSON text is not accepted as the native val structure.
- Decoded JSON equality skips unchanged layouts; an existing NULL/blank grid can be repaired.
Side effects
- Checks edit permission and saves the value with the Unix edit timestamp in a transaction, invalidating the widget cache. On failure no change is committed; no activity history, notification, or group timestamp update occurs.
See it in Fieldmotion
CRM1
No direct caller was found; CRM1 saves layout through ReportDashboards_setGrid.
CRM2
No direct caller was found; classic and new dashboards use the bulk layout endpoint.
Related endpoints
ReportDashboardGroups_listfinds groups visible to the current user.ReportDashboards_listloads stored widget configuration.ReportDashboardGroup_setMetaedits group metadata and sharing.