hello,
i have added ‘State_id’ column in ‘Users’ table and also created one table ‘States’ which contains state id and state names.i want dropdown of all state names (present in States table) in users module.So that while creating new user admin can select state of that user from that dropdown.when user is created corresponding state-id will go in State_id column of users table.
how to do it programmatically?
You are going about it wrongly, there is no need to manually add a ‘State_id’ column in ‘Users’ table etc. What you do is go into administration then studio and find the Users module. The go to fields and add a new field of the type dropdown, this will then let you create a list of states to add to your new dropdown field. You can then use studio to place it on the layout of the module etc…
In that case you should create a custom module called states, and then create a one to many relationship from states to users. Have a record in the module for each state then simple relate the user to a state when creating a new user. Doing customisations to Suite/Sugar is not as simple as just adding tables to the database and then adding code to pull it in. At least not if you want it done correctly and in an upgrade safe manner.
You are right but again having important fields scattered aroind several tables is a knightmare when using ETL / Reporting tools, not to mention performance…