Asset types
Clone an asset type
/a/AssetType_clone
Create a new asset type by copying one type’s legacy metadata and vehicle flags under a new name.
When to use this endpoint
Use AssetType_clone from the Asset Types setup screen when a new type should start with the same legacy custom template, QR redirect URL, and attribute flags as an existing type.
This is not a complete clone: type-specific CRM2 layouts, files, and the rental type are not copied.
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 | Positive source asset-type ID. The source must exist in the authenticated tenant. |
name | String | Yes | Name for the clone. A blank value is rejected. Duplicate detection trims and compares case-insensitively, but the inserted name itself is not trimmed. |
Example request
$clone = FM_api('AssetType_clone', [
'id' => '47',
'name' => 'Mobile Compressor',
]);
Example response
{
"ok": 1,
"id": 58
}
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":"invalid parameter: id"} | id is absent, zero, or negative. |
{"error":"invalid parameter: name"} | name is absent or blank. |
{"error":"Duplicate asset type name."} | Another tenant asset type has the same trimmed name, ignoring case. |
{"error":"asset type does not exist"} | The source ID is not found. |
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 legacy custom-field template and QR redirect URL are both inside
meta, so they are copied together without interpretation. - The clone receives a new integer ID and current server
last_editedtimestamp. The database default supplies rental type0. - There is no filtering or pagination; this is one insert after one source lookup.
Side effects
- Inserts one
asset_typesrow. It does not create a CRM2 custom layout, copy files, write a generic audit entry, or merge the tenant shared template.
See it in Fieldmotion
CRM1
Open Assets → Setup Asset Types, choose Clone beside a row, enter the new name, and filter Network requests for AssetType_clone.
CRM2
Open Asset Types, use the Clone action on a row, enter a unique name, and inspect AssetType_clone. CRM2 performs a client-side duplicate-name check before this server check.
Related endpoints
AssetType_newcreates a blank legacy type and applies the tenant shared template when configured.AssetType_getCustomLayoutcreates or resolves the separate CRM2 custom layout.