+ Start a Discussion
jaanvivekjaanvivek 

How to Achieve MD Relationship functionalities in Lookup Relationship

I need to implement the following scenarios in Lookup Relationship.

 

Scenario1-

 

We have one Object say like "A" it has three child objects say "B1", "B2", "B3" associated with Lookup Relationship.

There is a field named "Grand Revenue" on object  "A" and all three fields named "Revenue" on objects "B1" , "B2", "B3".

 

We need to implement

"Grand Revenue"= "Revenue"+"Revenue"+"Revenue" on A(Parent).

 

Scenario2-

 

If we delete one records on "A" all associated records should be deleted from childs "B1", "B2", "B3".

 

Could anyone please suggest how to achieve it.

 

Thanks for your suggestions.

 

Thanks,

JaanVivek

 

 

Starz26Starz26

Changing to a master-detail if possible would do this using built in functionality - but controlling the security model would not be possible for the child object.

 

1. You would have to write a trigger on the child every time it is created / edited (see above post)

2. You can contact salesforce to enable the new feature to delete lookup relationship records when parent is deleted. https://login.salesforce.com/help/doc/en/overview_of_custom_object_relationships.htm

jaanvivekjaanvivek

Thanks Starz26.

 

I would have to write trigger for all three childs i.e. B1,B2,B3.?

 

This post i need to refer http://www.anthonyvictorio.com/salesforce/roll-up-summary-trigger/

 

isn't it.

 

 

Thanks for your all time and suggestions.

 

 

Thanks,

JaanVivek