You need to sign in to do that
Don't have an account?
A chauhan
Apex class code for storing Account name (lookup) value in opportunity object with custom controller
I have custom controller Request_page .i want to create account name(lookup) field in my visualforce page and wants that account name value to be stored in Opportunity object Account name ! what should be the visualforce page code and apex code ?
Please refer below sample code.
Hope this helps you!
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
Thanks and Regards
Sandhya
It's saving for me I have tested it now.are you getting any error? Try put system.debug in the controller System.debug('oppp' +opp); before insert and see what values you are getting debug logs in the developer console.
Thanks and Regards
Sandhya
ok its similar way you used for other fields like Type, StageName, just use
Opp.Accountid= account; the Only thing is for lookup we use Accountid as the reference name.
Thanks and Regards
Sandhya