English
detail.render.before
About 369 wordsAbout 1 min
2025-12-16
This hook is called before the detail page is rendered and performs additional business actions before object detail rendering.
Parameters
functional registers the hook callback. The host passes the following parameters:
| Parameter | Description | Type | Allowed Values | Default |
|---|---|---|---|---|
| context | Event context containing common parameters | Object | -- | -- |
| plugin | Current plugin runtime information; business logic normally does not need it | Object | -- | -- |
| context.data | Data after detail parsing but before it is committed to page state | Object | -- | -- |
context.data
| Parameter | Description | Type | Default |
|---|---|---|---|
| data | Parsed field data for the current record | Object | -- |
| describe | Object describe processed by the detail page | Object | -- |
| objectDescribeExt | Extended object describe; may be absent when the interface does not return it | Object | undefined | -- |
| layout | Processed detail layout | Array | -- |
| components | Component configuration keyed by component API name | Object | -- |
| extendData | Detail extension data, including the ID list | Object | -- |
| privateProps | Internal detail page state; plugins should not modify it proactively | Object | -- |
Return Value
The hook may return Object or Promise<Object>. The returned object is shallow-merged into the top level of context.data before being committed as detail page state. When the hook returns nothing, the original data is used.
A direct throw from a synchronous callback is caught and logged by the PWC adapter, and the host proceeds as though the hook returned nothing. The current Detail wrapper does not handle a rejected Promise, including an exception thrown from an async callback, so the detail commit flow may remain pending. Catch and report asynchronous failures inside the hook, then resolve a usable result.
| Parameter | Description | Type | Allowed Values | Default |
|---|---|---|---|---|
| data | Overrides parsed field data for the current record | Object | -- | -- |
| describe | Overrides the processed object describe | Object | -- | -- |
| objectDescribeExt | Overrides the extended object describe | Object | -- | -- |
| layout | Overrides the processed layout | Array | -- | -- |
| components | Overrides component configuration | Object | -- | -- |
| extendData | Overrides detail extension data | Object | -- | -- |
Only these top-level properties are shallow-merged. Preserve the other fields of a nested object explicitly when changing one nested field.
Basic Examples
Basic Usage
export default class Plugin {
apply() {
return [{
event: 'detail.render.before',
functional: this.renderBefore.bind(this)
}];
}
renderBefore(context, plugin) {
return Promise.resolve({
data: {
...context.data.data,
field_q1Ibb__c: 'Value set by the plugin'
}
});
}
}Notes
1. Refreshing the detail page also triggers this hook.
