Hello,
I'de like to write a method that will delete the relationship item when relationship row is deleted.
Do anybody has an example that I can use.
Thank you,
Yelena
Why not just make the relationship dependent?
Andy
Andy,
Thank you for response. Could you please clarify? Maybe I did not explain correctly what i am looking for.
I have two itemtypes item1 and item2
item1 has a relationship to item2. I want the functionality which will delete the correspondent instance of item2 when relationship instance is deleted from the item1.
Thanks again for your help
Options:
1. Make IsDependent=1 for item2 ItemType (i believe this was meant by Andy).
2. Assign OnBeforeDelete and OnAfterDelete methods for item1_item2 is_relationship itemtype. OnBeforeDelete should put the relationship related_id value to session. OnAfterDelete method should take from session the related_ids to remove and remove item2 instnaces.
SamsAn.Original Mind Any Level Innovator Solutions Free-Lancer, http://sites.google.com/site/caraacc
Thanks for your help,
SamsAn,
You mention 'value to session'. How do you do that. I have set up the onBeforeDelete, now what do I do with the result? How do I pass the parameter to the OnAfterDelete Method?
Regards,
Kenneth
Use this to set your session on the OnBeforeDelete method event. Can be a string or object like the Item itself:CCO.Session["TheItemDeleted"] = deletedItem;
Use this to retrieve it from session on the OnAfterDelete method eventItem prevItem = (Item)CCO.Session["TheItemDeleted"]
Use this to remove it from session:CCO.Session.Remove("TheItemDeleted");