English
bom.calculateBomPrice.before
About 170 wordsLess than 1 minute
2026-05-08
Execution Timing
Before BOM price calculation
Parameters
| Parameter | Description | Type |
|---|---|---|
| rootData | Root data list | Array |
| children | All child item data | Array |
| needCalBom | Flag indicating whether BOM price calculation is required | Boolean |
| mdApiName | Metadata API name | String |
| param | Other parameter object | Object |
Return Result
| Parameter | Description | Type |
|---|---|---|
| needCalBom | Flag indicating whether BOM price calculation is required | Boolean |
Notes
- This hook is triggered before BOM price calculation and can be used to modify calculation parameters or control whether price calculation is executed.
- When the returned
needCalBomis true, the system executes BOM price calculation logic. - If the returned
needCalBomis false, BOM price calculation is skipped.
Code Example
export default class Plugin {
apply() {
return [{
event: "bom.calculateBomPrice.before",
functional: this.calculateBomPrice.bind(this)
},
];
}
calculateBomPrice(context){
let { rootData, children, needCalBom, mdApiName, param } = context;
// Determine whether BOM price calculation is required based on business logic
const shouldCalculate = this.checkIfCalculationNeeded(rootData, param);
return{
needCalBom: shouldCalculate
}
}
checkIfCalculationNeeded(rootData, param) {
// Custom business logic to determine whether BOM price calculation is required
return true;
}
}