When to use this endpoint

Use AssetTypes_mergeSharedCustomTemplate only with CRM1’s legacy Shared Custom Fields editor after storing tenant setting asset-shared-custom-format.

This route does not modify CRM2 layout rows; modern shared layout propagation is handled by the Layout APIs.

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
valJSON string or arrayYesComplete shared legacy template: pages with name and draggable. Invalid JSON/non-array input is treated as an empty template, removing previously shared entries while preserving local ones.

Example request

$result = FM_api('AssetTypes_mergeSharedCustomTemplate', [
	'val' => json_encode([
		[
			'name' => 'Main',
			'draggable' => [[
				'field_name' => 'inspection_class',
				'label' => 'Inspection class',
				'shared' => 1,
			]],
		],
	]),
]);

Example response

null

The handler has no explicit success return. A successful dispatcher response therefore encodes as JSON null.

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 val provided"}The val 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 fields with absent/zero shared are retained. Existing nonzero shared fields are removed before the supplied shared template is appended.
  • Supplied shared pages merge into existing tabs by exact page name, with local fields first. New page names are appended; existing local-only pages remain.
  • Malformed existing page/draggable structures are not validated and can emit warnings during the account-wide loop.
  • AssetType_new invokes this route automatically when asset-shared-custom-format is truthy, so creating one type can refresh every type timestamp.

Side effects

  • Rewrites the metadata and last_edited timestamp for every asset type and invalidates the asset-type cache repeatedly. It writes no per-field audit entries.

See it in Fieldmotion

CRM1

Open Assets → Setup Asset Types → Shared Custom Fields, edit fields, and save. CRM1 first stores asset-shared-custom-format, then calls this route.

CRM2

No direct production CRM2 caller was found. CRM2’s shared layout editor propagates through Layouts_saveField instead.

Related endpoints