When to use this endpoint

Use AssetType_setName for CRM1’s inline Asset Type rename controls. CRM2 normally saves the mapped name field through AssetType_updateData.

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

ParameterTypeRequiredDescription
idInteger stringYesPositive existing asset-type ID.
valStringYesReplacement name. Duplicate checking trims it and ignores case; storage preserves the supplied whitespace. A present blank string is accepted if it does not duplicate another blank name.

Example request

$result = FM_api('AssetType_setName', [
	'id' => '47',
	'val' => 'Mobile Compressor',
]);

Example response

{
  "ok": 1
}

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":"no ID provided"}id is absent, zero, or negative.
{"error":"no val provided"}The val key is absent.
{"error":"Duplicate asset type name."}A different type has the same trimmed name, ignoring case.
{"error":"asset_type does not exist"}The target 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

  • Renaming does not rename an existing type-specific layout group; its display name can retain the old type name.
  • The update runs even when the stored and supplied values are identical.

Side effects

  • Updates name and current server last_edited, then invalidates the asset-type cache. No generic audit entry is written.

See it in Fieldmotion

CRM1

Edit the Name cell on Assets → Setup Asset Types, or change Name on an Asset Type edit page, and inspect AssetType_setName.

CRM2

No direct production CRM2 call was found; configurable Asset Type edit layouts use AssetType_updateData, which does not perform this duplicate check.

Related endpoints

  • AssetType_new applies the same trimmed, case-insensitive duplicate rule during creation.
  • AssetType_updateData can rename through the CRM2 map without checking uniqueness.