rules repository

A-1130 Always follow naming conventions for page items.

Severity Warning Check + SQL-based Test Free

Reason

APEX automatically prefixes items with P{page_id}_. This ensures unique item names across an app and makes it predictable for developers to use them.

Example

Non-Compliant Example

page 3 (
    // ...
    pageItem FOLDER_NAME (
        // ...
    )
)
Issues
LineColumnMessage
314Page item FOLDER_NAME should be named P3_FOLDER_NAME.

Compliant Solution - ★★★★★

page 3 (
    // ...
    pageItem P3_FOLDER_NAME (
        // ...
    )
)

Tests

Test SQL query

select aa.workspace || '.' || aa.alias || '.' || pi.item_name as identifier,
       'Item ' || pi.item_name || ' in app ' || aa.alias || ' of ' || aa.workspace 
       || ' should be named ' || 'P' || pi.page_id || '_' || pi.item_name || '.' as message
  from apex_application_page_items pi
  join apex_applications aa on pi.application_id = aa.application_id
       and pi.workspace = aa.workspace
 where not regexp_like(pi.item_name, '^P' || pi.page_id || '_(.+)$')
   and pi.item_name not like '%P' || pi.page_id || '%'
   and aa.workspace in (#ApexWorkspaces#)
   and (json_value(json_array(#ApexAppIds#), '$[0]') is null
        or json_exists(json_array(#ApexAppIds#), '$[*]?(@ == $id)' passing to_char(aa.application_id) as "id"))

Test results

IdentifierMessageMigration
WORKSPACE.CUSTOMERS.FOLDER_NAMEItem FOLDER_NAME in app CUSTOMERS of WORKSPACE should be named P3_FOLDER_NAME.-

Parameters

Use parameters to customize the rule to your needs.

ParameterDescriptionDefault Value
ApexAppIdsComma-separated list of APEX application IDs to check. If empty, all applications of the workspaces are checked.,
ApexWorkspacesComma-separated List of APEX workspaces owning APEX applications to check.dblinter, dbl_gui

References