How can I delete child entities using end point , If I delete parent record (via end point ) in sugarcrm?
How can I delete child entities using end point , If I delete parent record (via end point ) in sugarcrm?
Hi Sagar Honrao,
It is not possible to delete all the related records via a single endpoint. For this firstly you need to get all the related records of the module via using /<module>/:record/link/:link_name GET and then need to delete all and then at the end need to delete the parent record.
Let me start by saying that I do not normally recommendation deletion of records. It is often more useful to mark them as Inactive so user can see still the history.
Depends upon your actual business use case, there are a few options but all will require coding:
1) Create a custom API end point for this.
2) Use a logic hook on the parent module that will perform the clean up on a before_delete/after_delete event.
3) Use a custom job/scheduler task to do this on a regular basis.
Let me start by saying that I do not normally recommendation deletion of records. It is often more useful to mark them as Inactive so user can see still the history.
Depends upon your actual business use case, there are a few options but all will require coding:
1) Create a custom API end point for this.
2) Use a logic hook on the parent module that will perform the clean up on a before_delete/after_delete event.
3) Use a custom job/scheduler task to do this on a regular basis.
Thank you Romney. I did this using scheduler and custom end point.
Romney Lai How do you mark a record as inactive? This functionality does not seem to exist any longer. I see the `deleted` column in a lot of modules, but it seems impossible to update that column value via the API.