+ Start a Discussion
shabbushabbu 

display selected values from multiselect picklist of Account object in opportunity object

Hi can any body help me in this,

I have multiselect picklist values of countries in account object and same  field i created in opportunity object,

i need display only selected values of multiselectpicklist from account on Opportunity object, both are in same vfpage and i need to save also in opportunity....

 

Advanced thanks its very urgent......

Mariappan PerumalMariappan Perumal

Hi , 

 

I didnt completely  understood your requirement ,  You said like you have separately created the picklist for both accounts and opportunity then there won't be any problem right. 

 

If i am wrong , please come again with the issue clearly 

shabbushabbu

i have one VFpage for save Account,Contact,opportunity objects.

In this vfpage i am showing the Countries multiselect picklist field of Account, i need to show selected values from Account on Opportunity section dynamically and save under the countries field of opportunity.

please help in this

sfdc_Dev_4sfdc_Dev_4

Hi Shabbu,

 

Correct if I am wrong on this; when you select the country from the field that is in Account object, you want to populate the same value for the field that is in Opportunity object. This means, you have one VFpage where you are capturing the address for Account, Contact and Opportunity. Is that right?

 

Also, can you please put the code that you have so far?

 

Thanks,

sfdc_dev

shabbushabbu
I am saving these three objects on final submission.
I need to display selected values of multiselect custom field on other pageblock section as checkbox or multiselect and need to save under opportunity. You got it what i am saying
sfdc_Dev_4sfdc_Dev_4

Hi Shabbu,

 

If the address info for account and Opportunity are going to be the same then do you even have to display it twice. If you just display it once in your VFpage then you can store it in some variable which you can set it later in whichever field of accout and opportunity object. 

 

Thanks,

sfdc_dev

shabbushabbu

Hi,
you didn't understand exactly but i solve my problem and now i need to save it on opportunity object.[i displayed dynamically what user selects in multiselect picklist field of account using check boxes on same vfpage and now i need to save it on Opportunity object.

public list<string> countrieslist{get; set;}   //  this is the checkbox method 

 

public pagereference save(){

insert account;

 

Account acctn=[select Country__c from Account where Country__c =:countrieslist ];
opportunity.Opp_Country__c=acctn.Country__c;
insert opportunity;

}

 

Here Opportunity object is not saving, if you know help me in this.....

sfdc_Dev_4sfdc_Dev_4

Hi Shabbu,

try the code below,

 

 

public list<string> countrieslist{get; set;}   //  this is the checkbox method 

 List<Opportunity> opp1= new List<Opportunity>();

 

public pagereference save(){

insert account;

 

Account acctn=[select id, Country__c from Account where Country__c =:countrieslist ];

List <Opportunity> opport = [select id, country__c, accountid from Opportunity where AccountId IN: acctn.id];

for (Opportunity opp: opport) {
opport.Opp_Country__c=acctn.Country__c;
opp1.add(opportunity);

}

insert opp1;

}

 

Thanks,

sfdc-Dev