Retrieve the current object to associate with the pre-committed object.

Hi, I have 3 entities, let say company, employee and department. While user is trying to create the company object, he should be able to add employee objects to company. After creating and committing the company object with associated employees, the user should create a department object and while creating this department object, he should be  to see all the companies to select any of the company. When user clicks on a particular company, the employees associated to this should pop up. Then we need to assign the current department object to a particular employee. The problem is i'm unable to retrieve the current department object to assign it to the employee object. Could some one help me out with this.
1 answers

department should have a association to company and employee.

Use the constrained by option on the employee selection to match the selected company