-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

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

  • 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? – Pramod Kumar Oct 9 '12 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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.