-1

I am newbie to salesforce.Can some one explain how can i create self relationship in salesforce. I know salesforce doesn't provide out of the box this relationship.

My Scenario is i have a Company object. Every company should have a parent company which can be any other company. If parent is not defined then current company automatically become the parent of itself.

Can anyone explain how can i achive this.

Thanks

2 Answers 2

2

You can create a lookup relationship in Company object to itself.

To populate the value of the company name to itself(if the parent is not defined), you can write a trigger to populate the value as Salesforce does not have default value option for lookup field

1
  • ok got your point thanks. but one more thing lookup is manu to one relationship right so how would i interpret in here? will a company can have multiple parent or a company can we parent of multiple company? Oct 9, 2012 at 6:58
0

You could use account hierarchies (not sure what SF version you have).

Than use a field update rule, and/or default value on parent account to set it to the account it self.

Or better - an afterupdate trigger that checks the parent account.

3
  • i am using sales force 12 Oct 9, 2012 at 6:57
  • Enterprise, professional, unlimited? Developer? Not the release number.
    – Saariko
    Oct 9, 2012 at 7:18
  • developer. Edition Oct 9, 2012 at 7:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .