Hi
I have a datasource with a runtime function parameter that calculate a line price based on quantity and price, something like this:
if (!quantity) return price*quantity
My issue is that if this object is removed from the datasource by setting a flag (deleted=true is the datasource filter), the function still tries to execute the function parameter to get the line price, even though the object is no longer in the datasource. This generates errors which I want to get rid of.
||message: Error running function: Cannot read properties of undefined (reading ‘quantity’),|
|—|—|
||functionName: fn49074aa3,|
||functionParameters: [|
This error is shown in dev console every time an object is removed.
Is it possible to avoid the errors without changing the way the datasource behaves? It does not help to check if quantity is set since the object itself is no longer in the datasource.
This looks like some kind of timing issue, the function parameter is executing on objects that no longer exist in the datasource - and fails because the object is no longer there.
Regards