Asset types
Resolve an asset-type custom layout
/a/AssetType_getCustomLayout
Resolve an asset type’s CRM2 custom layout, optionally creating it from the tenant shared Asset layout.
When to use this endpoint
Call AssetType_getCustomLayout before opening CRM2’s custom-layout editor for a particular asset type.
Without alwaysCreate, it can be used as a read/fallback lookup: an existing type-specific group wins, otherwise the shared group ID is returned.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.
The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Asset-type ID. Only key presence is validated; zero and nonexistent IDs are accepted by the creation path. |
alwaysCreate | Integer string | No | Defaults to 0. A nonzero value creates a missing type-specific group and copies the shared layout rows. |
Example request
$layout = FM_api('AssetType_getCustomLayout', [
'id' => '47',
'alwaysCreate' => '1',
]);
Example response
{
"ok": 1,
"id": 731
}
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"} | The id key is absent. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Existing groups are found through
layout_groups.meta.assetTypeID. If multiple groups match, the query establishes no precedence. - The fallback shared group comes from page setting
pageLayouts.layoutAssetTypeCustomField. If that setting is missing, a non-creating lookup returns ID0. - Creation copies the shared group’s layout rows in parent/ID order and remaps parent IDs. The new group has
table_name="asset",hidden=true, and the supplied asset-type ID.
Side effects
- With
alwaysCreate=1, inserts one layout group and zero or more layout rows. The copy is not transactional, so a partial layout can remain after a later insert failure.
See it in Fieldmotion
CRM1
No direct production CRM1 caller was found. CRM1 edits the older custom template stored inside asset_types.meta.
CRM2
Open an Asset Type, choose Custom Details, and inspect AssetType_getCustomLayout. CRM2 sends alwaysCreate=1 before navigating to the layout editor.
Related endpoints
AssetTypes_getCustomFieldslists custom definitions from these CRM2 layout groups.AssetType_setTemplatechanges the separate legacy template.