Combine methods in SmartObject: Delete all entries with specific parameter


Hello,

 

this question is probably silly, but I cannot get my head around it.

 

Is there a way to create combined SmartObject method, that deletes all entires with a given parameter. I realize, that this could be done in Workflow Designer with Loop step - I just want to find solution that a process wouldn't be necessary.

 

Lets say we have a Car SmartObject - this car has many Car_Parts. And when I delete this Car SO, I also want to delete all of its Car_Parts. There would be a method in Car SmartObject called Delete All Car Parts - which does exactly that. 

 

I want to delete all of the car parts with this method(s), that takes parameter Car_ID. How do I configure this method(s) to achieve that - it doesn't seem intuitive to me.

 

Many thanks.


2 replies

If your are using SQL integration the simple stored procedure should do the job. Something that you would pass parameter into and it would delete all rows where condition is true. You can bind this method to an existing SmartObject. However I have no experience using non-SQL integrated SMOs. So if that is the case I am not sure. 

Any way of doing this without using a SQL stored procedure?

 

Only other way I can see to do this (so far) is not combine methods. It would be to create a new Delete method (per child SmartObject) whereby the input parameter is mapped to the 'Foreign Key' column instead of ID column.

 

I need to do something similar whoever I have about 8 child tables all linked to a header table. I want to delete all entries in the child tables based on the parent ID, and then delete the parent in the main header table.

 

I'm trying to avoid SQL.

Reply