I have 2 records A and B with one to many relationships, both the records contains a column isActive(boolean). I have a process model that is triggered as related action of record A and this process model contains Start Process(node) with MNI, and a child process will be triggered for each child of record A, this child process is used to deactivate the corresponding child record by marking isActive as false. Here the requirement is, only when all the child process instances finsh by marking the corresponding child rows as deactivated, we need to deactivate the Parent row in the Parent process model,
How can we achieve this?
I tried using send mesaage and recieve message events and it's working but I am not sure this is a preferred way as we are sending message from each and every child instance, if we have 1000 child records 1000 messages will be sent, I don't know weather sending these many messages cause any issue. Is it fine to use the approach or do we have to do something other than this
Discussion posts and replies are publicly visible
Please help me. You do all of this process-calls-sub-process+messaging thing just to update a few rows in the DB? Is this an automatic process? This does not feel like a very efficient implementation.
Why not just do a query database node or call a stored procedure to update all children. Then query whether all have been deactivated and then update the parent accordingly.
Totally agree with Stefan Helzle ... seems better , easier and more efficient...
Stefan Helzle David J (NTT DATA) To add on here the requirement is not just about updating the DB, we have few integrations to perform on each child row then need to update the DB that's the reason I went through that approach, if its just updating the DB I think we can directly update the Parent record and all its child records just using one write records smart service as they had one to many relation,
Only when all the child process perform the integrations and updates the DB only the I need to end the Parent process, what should I do when I use Start process to trigger child processes
OK. Makes sense. I would try not to use messaging.
One option might be to use process reporting to monitor the children from the parent in a wait-loop to continue once all children have completed.
One other option could be that every time child process completes, that process model checks if all the related child cases are completed. if answer is yes then mark the parent case as completed.
Stefan Helzle Could you please explain how to implement or which node should I use or which function should I use to check weather child process have completed or not,
And is there any specific reason why not to use messaging?
Kumar Agniwesh Could you please add few more points and explain how to implement this, like how to check related cases are completed or not every time child process completes
Any specifice nodes/smart services or functions that I should use
Messaging can increase the load on the system as because of the event listeners.
Devarneni Shiva Prasad Rao said:Could you please explain how to implement or which node should I use or which function should I use to check weather child process have completed or not,
What do you mean. A process report showing all the child processes, and an expression using queryprocessanalytics to check it. Run this in a loop with a reasonable interval.. Do you have any specific questions?
You can query status of related child cases of the parent case from the current child case. if the status of all child cases are completed you can mark parent case as completed.