When to use this endpoint

Use UserRole_updateData for role-name edits from CRM2’s role list/detail screens. Access fields are updated separately.

Authentication and permissions

The authenticated context must contain pageUserRoles_edit or the global all role permission.

The permission check runs before explicit login validation. Its legacy denial text incorrectly says “copy role.”

Parameters

ParameterTypeRequiredDescription
idInteger string or native arrayYesTarget role ID or native list. Bulk mode runs sequentially, discards per-row results, and returns success. JSON array text is not decoded.
nameStringNoComplete replacement. Blank and duplicate names are accepted on update; there is no endpoint length check before the 100-character column.
cDateDatetime stringNoReplacement creation datetime. Blank becomes SQL null; nonblank input is not date-validated.
lastEditedUnix seconds or date textNoMapped input is accepted, but any actual change appends the current Unix time and therefore overrides an explicit value.
noRecordNative arrayNoInternal audit control listing mapped keys whose history should be hidden.

Example request

$result = FM_api('UserRole_updateData', [
	'id' => '12',
	'name' => 'Senior dispatch supervisor',
]);

Example response

{
  "ok": 1
}

Scalar no-op input returns {"warning":"No Change."}; a missing row returns {"warning":"No data."}; unknown-only update keys return {"warning":"no updated fields."}.

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":"You do not have the correct permissions to copy role."}The edit permission is absent; this is the handler’s misleading legacy text.
{"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

  • Unknown keys are ignored. Scalar zero normally returns No data.; there is no explicit positive-ID validation.
  • Any mapped change advances last_edited to current Unix seconds.
  • Role access and assigned users are not changed.

Side effects

  • Updates matching role rows, invalidates the user-roles cache, and writes generic field-level audit history.
  • Bulk mode is non-transactional and hides individual warnings/errors.

See it in Fieldmotion

CRM1

No direct CRM1 caller was found.

CRM2

Editing a role from Users → Roles or its detail screen calls this route after a client-side duplicate-name check.

Related endpoints