English
detail.parse.before
About 373 wordsAbout 1 min
2025-12-16
This hook is called before the detail page processes data. It can process or modify detail data 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 | Complete interface data before detail page parsing | Object | -- | -- |
context.data
| Parameter | Description | Type | Default |
|---|---|---|---|
| data | Raw field data for the current record | Object | -- |
| describe | Raw describe for the current object | Object | -- |
| objectDescribeExt | Extended object describe; may be absent when the interface does not return it | Object | undefined | -- |
| layout | Raw detail layout and component configuration | Object | -- |
context.data may also contain approval, process, or business extension fields. Preserve original data that does not need to change.
Return Value
The hook may return Object or Promise<Object>. The returned object is shallow-merged into the top level of context.data before detail parsing. 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 parsing 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 raw field data; preserve other fields when changing one field | Object | -- | -- |
| describe | Overrides the raw object describe | Object | -- | -- |
| objectDescribeExt | Overrides the extended object describe | Object | -- | -- |
| layout | Overrides raw layout and component configuration | Object | -- | -- |
| miniSide | Whether the right-side area is collapsed by default; omission uses the local user cache | Boolean | -- | -- |
| tabsMemoryTab | Whether tabs remember the last selection | Boolean | -- | true |
Basic Examples
Modify Record Data
export default class Plugin {
apply() {
return [{
event: 'detail.parse.before',
functional: this.parseBefore.bind(this)
}];
}
parseBefore(context, plugin) {
return Promise.resolve({
data: {
...context.data.data,
name: 'Name set by the plugin'
}
});
}
}Disable Tab Selection Memory
return Promise.resolve({
tabsMemoryTab: false
});Expand the Right-side Area by Default
return Promise.resolve({
miniSide: false
});Notes
1. Refreshing the detail page also triggers this hook.
