English
price-service.batchAddAfter.after
About 207 wordsLess than 1 minute
2026-05-08
Execution Timing
After batch-added data has completed the pricing service
Parameters
| Parameter | Description | Type |
|---|---|---|
| data | Detail object data to add | Array/Object |
| realPriceData | Pricing API response | Object |
| lookupDatas | Metadata corresponding to the added data | Array/Object |
| mdApiName | Metadata API name | String |
| param | Other parameter object | Object |
Return Value
No return value
Notes
- This hook is triggered after batch-added data has completed the pricing service and can be used to process pricing results and backfill data.
- In this hook, original data can be updated based on pricing results or other post-processing logic can be executed.
- This plugin has no return value and directly modifies the incoming data object.
- The complete pricing service response can be obtained through
realPriceDatafor further processing.
Code Example
export default class Plugin {
apply() {
return [{
event: "price-service.batchAddAfter.after",
functional: this.batchAddAfter.bind(this)
},
];
}
async batchAddAfter(context){
let { data, realPriceData } = context;
// Ensure data is in array format
let dataArray = data;
// Process each data item
dataArray.forEach((item, index) => {
// Get the corresponding price information from the pricing result
if(realPriceData && realPriceData.items && realPriceData.items[index]) {
const priceInfo = realPriceData.items[index];
// Backfill price information into the original data
item.unitPrice = priceInfo.unitPrice;
item.finalPrice = priceInfo.finalPrice;
// Add pricing timestamp
item.priceUpdateTime = new Date().toISOString();
}
});
}
}