function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rishi jaykar 1rishi jaykar 1 

Please give me solution for this cenario:

1. Following object and fields that you need to create.
a. Object: Employee
 i. Employee Designation
ii. Account Name(Required Field)(Lookup Field)
iii. Contact Name(Required Field)(Lookup Field)
 2. Create a Visualforce page that will display above mentioned 3 fields.
 3. Create following two buttons on the Visualforce created in #2. a. Create b. Cancel
4. Both fields “Account Name” and “Contact Name” will have functionality of autocomplete and search. For example “Account Name” field will have search functionality of all account.(When you click inside of text field it will display 10 records and similarly when you type first 3 character of any account name it will display that account name).
5. For second field which will be “Contact name”, it will search the contact based on Account selected in Account field.
 a. For example, let’s say if you selected one account name as “Acc” then it will display contact based on the account name selected in Account field.
 b. This field “Contact Name” should also have the the functionality same as “Account Name” field
● Please see below screenshot If you have any confusion on Autocomplete.
User-added image
Account Name field and Contact Name field should be mandatory. That means if user is try to create new Employee record without selecting any value in those fields then it should display error message as Account and Contact Name is mandatory.
Test Org 56Test Org 56
Hi Rishi,
it can be achieved by using the javascript logic.
call the the javascript function and in javascript function us the  sforce object which call the your apex logic,
but remeber your gorvenor limit may crossed in SOQL.