on 2024 Aug 19 12:02 PM
Hi colleagues
I'm trying to implement next scenario:
I have 2 Node.js apps working with a same data. First app hosts a service to input data (let's call it Contracts). Second app is performing (re)calculations for the Contracts on demand.
I want to trigger re-calculation when I successfully activate the draft so in the input app I'm using
async onAfterContractActicate(res: Contract, req: any): Promise<void> {
const ID: Contract["ID"] = req.data.ID;
req.on('succeeded', async () => {
const srv = await cds.connect.to('ExternalCalculatorService');
await srv.post(`/Contracts(ID=${ID},IsActiveEntity=true)/calculate`, {});
});
}
so the desired logic is:
The issue is that the succeeded event is triggered after the response is being prepared and finalised so it's too late to change res or trigger req.reply as it's simply ignored.
The question is - how to get re-calculated data to the object page without weird FE extensions?
I tried
Request clarification before answering.
User | Count |
---|---|
30 | |
22 | |
16 | |
8 | |
7 | |
6 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.