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
Attribution to: Pramod Kumar
Possible Suggestion/Solution #1
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
Attribution to: Priyanka
Possible Suggestion/Solution #2
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.
Attribution to: Saariko
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/2063