A-1400 Never keep the default name New for components.
Reason
APEX gives a freshly created component the name New (page items P<n>_NEW; with _1, _2 … for further ones). A component that keeps this name says nothing about its purpose, makes the page hard to read and invites mix-ups, especially in the debug log and the page designer.
Give it a name that describes what it does or holds. For page items, update all references (&P10_NEW., :P10_NEW, dynamic actions, validations) after renaming.
The rule checks the component types that APEX names New itself: page items (P<n>_NEW), buttons, regions, page processes, dynamic actions and their steps, validations and chart series.
Example
Non-Compliant Example
page 10 (
// ...
pageItem P10_NEW (
type: textField
// ...
)
region details (
name: New
// ...
)
) | Line | Column | Message |
|---|---|---|
| 3 | 14 | |
| 8 | 15 |
Compliant Solution - ★★★★★
page 10 (
// ...
pageItem P10_NAME (
type: textField
// ...
)
region details (
name: Customer details
// ...
)
) Tests
Test SQL query
select aa.workspace || '.' || aa.alias || '.' || c.page_id || '.' || c.item_name as identifier,
'Item ' || c.item_name || ' on page ' || c.page_id || ' of app ' || aa.alias || ' in '
|| aa.workspace || ' still has its default name.' as message
from apex_application_page_items c
join apex_applications aa
on aa.application_id = c.application_id
and aa.workspace = c.workspace
where aa.workspace in (#ApexWorkspaces#)
and regexp_like(c.item_name, '^P\d+_NEW(_\d+)*$')
union all
select aa.workspace || '.' || aa.alias || '.' || c.page_id || '.' || coalesce(c.static_id, to_char(c.button_id)) as identifier,
'Button ' || c.button_name || ' on page ' || c.page_id || ' of app ' || aa.alias || ' in '
|| aa.workspace || ' still has its default name.' as message
from apex_application_page_buttons c
join apex_applications aa
on aa.application_id = c.application_id
and aa.workspace = c.workspace
where aa.workspace in (#ApexWorkspaces#)
and c.label = 'New'
and regexp_like(c.button_name, '^New(_\d+)*$', 'i')
union all
select aa.workspace || '.' || aa.alias || '.' || c.page_id || '.' || coalesce(c.static_id, to_char(c.region_id)) as identifier,
'Region ' || c.region_name || ' on page ' || c.page_id || ' of app ' || aa.alias || ' in '
|| aa.workspace || ' still has its default name.' as message
from apex_application_page_regions c
join apex_applications aa
on aa.application_id = c.application_id
and aa.workspace = c.workspace
where aa.workspace in (#ApexWorkspaces#)
and regexp_like(c.region_name, '^New(_\d+)*$')
union all
select aa.workspace || '.' || aa.alias || '.' || c.page_id || '.' || coalesce(c.static_id, to_char(c.process_id)) as identifier,
'Process ' || c.process_name || ' on page ' || c.page_id || ' of app ' || aa.alias || ' in '
|| aa.workspace || ' still has its default name.' as message
from apex_application_page_proc c
join apex_applications aa
on aa.application_id = c.application_id
and aa.workspace = c.workspace
where aa.workspace in (#ApexWorkspaces#)
and regexp_like(c.process_name, '^New(_\d+)*$')
union all
select aa.workspace || '.' || aa.alias || '.' || c.page_id || '.' || coalesce(c.static_id, to_char(c.dynamic_action_id)) as identifier,
'Dynamic action ' || c.dynamic_action_name || ' on page ' || c.page_id || ' of app ' || aa.alias || ' in '
|| aa.workspace || ' still has its default name.' as message
from apex_application_page_da c
join apex_applications aa
on aa.application_id = c.application_id
and aa.workspace = c.workspace
where aa.workspace in (#ApexWorkspaces#)
and regexp_like(c.dynamic_action_name, '^New(_\d+)*$')
union all
select aa.workspace || '.' || aa.alias || '.' || c.page_id || '.' || to_char(c.action_id) as identifier,
'Dynamic action step ' || c.dynamic_action_name || '.' || c.action_pd_name || ' on page ' || c.page_id || ' of app ' || aa.alias || ' in '
|| aa.workspace || ' still has its default name.' as message
from apex_application_page_da_acts c
join apex_applications aa
on aa.application_id = c.application_id
and aa.workspace = c.workspace
where aa.workspace in (#ApexWorkspaces#)
and regexp_like(c.action_pd_name, '^New(_\d+)*$')
union all
select aa.workspace || '.' || aa.alias || '.' || c.page_id || '.' || coalesce(c.static_id, to_char(c.validation_id)) as identifier,
'Validation ' || c.validation_name || ' on page ' || c.page_id || ' of app ' || aa.alias || ' in '
|| aa.workspace || ' still has its default name.' as message
from apex_application_page_val c
join apex_applications aa
on aa.application_id = c.application_id
and aa.workspace = c.workspace
where aa.workspace in (#ApexWorkspaces#)
and regexp_like(c.validation_name, '^New(_\d+)*$')
union all
select aa.workspace || '.' || aa.alias || '.' || c.page_id || '.' || to_char(c.series_id) as identifier,
'Chart series ' || c.region_name || '.' || c.series_name || ' on page ' || c.page_id || ' of app ' || aa.alias || ' in '
|| aa.workspace || ' still has its default name.' as message
from apex_application_page_chart_s c
join apex_applications aa
on aa.application_id = c.application_id
and aa.workspace = c.workspace
where aa.workspace in (#ApexWorkspaces#)
and regexp_like(c.series_name, '^New(_\d+)*$')Test results
| Identifier | Message | Migration |
|---|---|---|
| WORKSPACE.CUSTOMERS.10.P10_NEW | Item P10_NEW on page 10 of app CUSTOMERS in WORKSPACE still has its default name. | - |
| WORKSPACE.CUSTOMERS.10.108087001605795312 | Region New on page 10 of app CUSTOMERS in WORKSPACE still has its default name. | - |
Parameters
Use parameters to customize the rule to your needs.
| Parameter | Description | Default Value |
|---|---|---|
| ApexWorkspaces | Comma-separated List of APEX workspaces owning APEX applications to check. | dblinter, dbl_gui |
References
- same as UC-1400