You need to sign in to do that
Don't have an account?
Can anyone know how to Bind External Data in picklist ?
Wrapper class:-
public class MailMergeGroupContactsListwrap {
public string GroupName{get;set;}
}
Apex Page:-
global class SalesforceVersionInfo
{
public List<MailMergeGroupContactsListwrap> ConsoleWrapperList5{get;set;}
// public List<SFInstance> sfInstances{get;set;}
public List<MailMergeGroupContactsListwrap> getperformcallout5()
{
// public SalesforceVersionInfo() {
String jsonString = '[{"GroupContactID":539,"GroupName":"Recently modified Oct 6","TotalContacts":275},{"GroupContactID":538,"GroupName":"New Contacts Oct 6","TotalContacts":973},{"GroupContactID":529,"GroupName":"Egrabber test 2","TotalContacts":3},{"GroupContactID":526,"GroupName":"Unopened List 16","TotalContacts":721},{"GroupContactID":525,"GroupName":"Unopened List 15","TotalContacts":710},{"GroupContactID":524,"GroupName":"Unopened List 14","TotalContacts":700},{"GroupContactID":523,"GroupName":"Uploaded List 13","TotalContacts":700},{"GroupContactID":522,"GroupName":"Unopened List 12","TotalContacts":900},{"GroupContactID":521,"GroupName":"Unopened List 11","TotalContacts":900},{"GroupContactID":520,"GroupName":"Unopened List 10","TotalContacts":900},{"GroupContactID":402,"GroupName":"CS_Seattle_Mgr_10kplus_RQ","TotalContacts":523},{"GroupContactID":371,"GroupName":"List 1 Channel Manger Boston Linkedin","TotalContacts":141},{"GroupContactID":68,"GroupName":"DoD test email list","TotalContacts":3}]';
ConsoleWrapperList5= (List<MailMergeGroupContactsListwrap>) System.JSON.deserialize(jsonString,List<MailMergeGroupContactsListwrap>.class);
return consolewrapperlist5;
}
global class MailMergeGroupContactsListwrap implements Comparable
{
public String GroupContactID {get;set;}
public String GroupName {get;set;}
public String TotalContacts {get;set;}
public Integer compareTo(Object ObjToCompare)
{
return GroupContactID.CompareTo(((MailMergeGroupContactsListwrap)ObjToCompare).GroupContactID);
}
}
}
Visualforce Page :--
<apex:page controller="SalesforceVersionInfo">
<apex:form >
<apex:pageBlock >
<apex:repeat value="{!performcallout5}" var="val">
{!val.GroupName}<br/>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>
I want picklist here.
Thanks....
public class MailMergeGroupContactsListwrap {
public string GroupName{get;set;}
}
Apex Page:-
global class SalesforceVersionInfo
{
public List<MailMergeGroupContactsListwrap> ConsoleWrapperList5{get;set;}
// public List<SFInstance> sfInstances{get;set;}
public List<MailMergeGroupContactsListwrap> getperformcallout5()
{
// public SalesforceVersionInfo() {
String jsonString = '[{"GroupContactID":539,"GroupName":"Recently modified Oct 6","TotalContacts":275},{"GroupContactID":538,"GroupName":"New Contacts Oct 6","TotalContacts":973},{"GroupContactID":529,"GroupName":"Egrabber test 2","TotalContacts":3},{"GroupContactID":526,"GroupName":"Unopened List 16","TotalContacts":721},{"GroupContactID":525,"GroupName":"Unopened List 15","TotalContacts":710},{"GroupContactID":524,"GroupName":"Unopened List 14","TotalContacts":700},{"GroupContactID":523,"GroupName":"Uploaded List 13","TotalContacts":700},{"GroupContactID":522,"GroupName":"Unopened List 12","TotalContacts":900},{"GroupContactID":521,"GroupName":"Unopened List 11","TotalContacts":900},{"GroupContactID":520,"GroupName":"Unopened List 10","TotalContacts":900},{"GroupContactID":402,"GroupName":"CS_Seattle_Mgr_10kplus_RQ","TotalContacts":523},{"GroupContactID":371,"GroupName":"List 1 Channel Manger Boston Linkedin","TotalContacts":141},{"GroupContactID":68,"GroupName":"DoD test email list","TotalContacts":3}]';
ConsoleWrapperList5= (List<MailMergeGroupContactsListwrap>) System.JSON.deserialize(jsonString,List<MailMergeGroupContactsListwrap>.class);
return consolewrapperlist5;
}
global class MailMergeGroupContactsListwrap implements Comparable
{
public String GroupContactID {get;set;}
public String GroupName {get;set;}
public String TotalContacts {get;set;}
public Integer compareTo(Object ObjToCompare)
{
return GroupContactID.CompareTo(((MailMergeGroupContactsListwrap)ObjToCompare).GroupContactID);
}
}
}
Visualforce Page :--
<apex:page controller="SalesforceVersionInfo">
<apex:form >
<apex:pageBlock >
<apex:repeat value="{!performcallout5}" var="val">
{!val.GroupName}<br/>
</apex:repeat>
</apex:pageBlock>
</apex:form>
</apex:page>
I want picklist here.
Thanks....
You can try this one -
Replace your Apex class with this one - Replace with your visualforce page with thsi one - Replace your wrapper class with this one - Pls, let me know if it helps you.
Thanks,
Sumit Kuamr Singh
All Answers
Can you please be more specific?
Do you to show the JSON data into PickList? If yes try this -
In the apex class, add this - On the Visulaforce Page, add this -
Thanks,
Sumit Kumar Singh
Thanks Sumit for your reply.
It show an error :- Invalid ConsoleWrapperList5 ??
what is the use of :- public string productName{get;set;}
<apex:selectList size="1" value="{!productName}">
Where i will implement your code ?
Thanks.
Why do you have 2 classes with the same name??
I can see one 'MailMergeGroupContactsListwrap' with only one variable 'GroupName'. Second class with the same name inside the 'SalesforceVersionInfo' class with 3 varaibles. Why??
Either change the name of classes or keep only one delete the other one.
Plese, share the whole Apex Controller and Visualforce Page.
public string productName{get;set;} - This is to get the value of seleted picklist from the visualforce page.
<apex:selectList size="1" value="{!productName}"> This is to show the picklist on Visualforce Page. Toy can change the name whatever you want.
Thanks,
Sumit Kuamr Singh
Paste your code again with the help of above icon.
Please check my code .
Thanks
You can try this one -
Replace your Apex class with this one - Replace with your visualforce page with thsi one - Replace your wrapper class with this one - Pls, let me know if it helps you.
Thanks,
Sumit Kuamr Singh
I highly appricate you :)
can you plaese share your Skype Id or Email Id ?
You can reach me @ skype : sumit3887, emailId : gbu.sumit@gmail.com
Thanks,
Sumit Kumar Singh