giggty
23rd November 2017, 10:42
Hello everyone,

so I need to create a new record in whinh290 when a new row is inserted into whinh220. I tried different approaches:

1. I created Extension for whinh220, where inside after.save.object(long mode) hook I added my code. But it was not working. Judging from the trace file it seems like adding a record into whinh290 causes an update on whinh220 creating recursion.
2. So I decided to try out running whinh290 update code with activate() as a separate process. I fiddle around a bit with suspend() to leverage actual running times of main and child threds. And sometimes it does seem like a record in whinh290 was created (i'm checking it in ttaad4100), but after a while it gets removed so I suspect transaction doesn't end properly.
3. I also tried creating whinh220ue DLL and using ue.after.after.save.object(long mode) hook for updating whinh290. Same problem: it recurs.
Process 65 - Fatal Error : Function 'ue.before.after.save.object': recursion not possible; refcount=2.
Process 65 - Fatal Error : Can not continue in whinh2120m000 in DLL: owhinh220ue (ue.after.after.save.object)[last function:exec_function]
Process 65 - Error : whinh2120m000: A not terminated transaction is aborted (ue.after.after.save.object() in object owhinh220ue)
(Also for some reason I can't use CDFs inside whinh220ue)

I'm using dal.new.object() and dal.save.object() for inserting records into whinh290.

What can be done here?

giggty
28th November 2017, 15:21
If anyone is interested, here are two possible solutions:
1. Use db.insert() instead of dal.new.object(), so that whinh290 DAL doesn't get called.
2. Before calling dal.save.object() one should issue dal.start.business.method("whinh290", "set.update.outbound.line.to.false", ret.val.long) and no update on whinh220 will follow ;)

mark_h
28th November 2017, 19:16
Always interested in solutions - it might help someone in the future. So thanks for posting those possible solutions.