You need to sign in to do that
Don't have an account?
sivapriyaa maniam sivakumar
Thanks
Sivapriyaa M S
How to get the Countryname instead of Country code
Hi how to get the countryname instead of country code in vfp. I need countryname alone from standard country and state picklist. Pls view my code and tell me . Thanks in advance
// APEX CODE Public with sharing class SOSLController { Public List<loc__c> location {get;set;} // location public String imageURL{get;set;} // display a image Public String searchStr{get;set;} // find a string private ApexPages.StandardController Controller; private final Contact cnct; /* display a image -method*/ public SOSLController(ApexPages.StandardController Controller) { imageURL='/servlet/servlet.FileDownload?file='; List< document > documentList=[select name from document where Name='logo']; if(documentList.size()>0) { imageURL=imageURL+documentList[0].id; } this.cnct = (Contact)controller.getRecord(); } /* find a string and run the sosl query*/ Public void soslDemo_method(){ location = New List<loc__c>(); system.debug('inside sosl method'); system.debug('country is'+cnct.MailingCountry ); system.debug('state is'+cnct.MailingState); // if(searchStr.length() > 1){ // // String searchStr1 = searchStr; // String searchQuery = 'FIND \'' + state + '\' IN ALL FIELDS RETURNING loc__c(Comp__c, Type__c,Client__c, Competitor__c,Event_Name__c, evt_Des__c , Dt_Ti__c, Ct_person__c,Ph_Num__c )'; location = [SELECT Comp__c, Client__c, Competitor__c, Type__c, Event_Name__c, evt_Des__c, Address1__c, Address2__c, City__c, Country__c, State_Province__c, Zip_Code__c, Dt_Ti__c, Ct_person__c, Ph_Num__c FROM loc__c WHERE State_Code__c =:cnct.MailingStateCode ]; // List<List <sObject>> searchList = search.query(searchQuery); //location = ((List<loc__c>)searchList[0]); /* Message */ /* if(location.size() == 0){ apexPages.addmessage(new apexpages.message(apexpages.severity.Error, 'Sorry, Type the location correctly or There is no details of the requested location found')); return; } else{ apexPages.addmessage(new apexpages.message(apexpages.severity.Error, 'Please enter the location..')); return; }*/ } }VFP;
<apex:page standardController="Contact" extensions="SOSLController" sidebar="false" showHeader="false"> <apex:form > <apex:image url="{!imageURL}"> </apex:image> <apex:pageBlock title="Enter a location" id="acct1"> <apex:outputLabel value="Country" /> <apex:inputField value="{!contact.MailingCountryCode}" /> <apex:outputLabel value="State" /> <apex:inputField value="{!contact.MailingStateCode}" /> <apex:commandButton value="Submit" action="{!soslDemo_method}" reRender="acct,error,acct1" /> <apex:outputPanel title="" id="error"> <apex:pageMessages ></apex:pageMessages> </apex:outputPanel> </apex:pageBlock> <apex:pageBlock title="Details of technical events" id="acct"> <apex:pageblockTable value="{!location }" var="acc"> <apex:column value="{!acc.Comp__c}"/> <apex:column value="{!acc.Type__c}"/> <apex:column value="{!acc.Client__c}"/> <apex:column value="{!acc.Competitor__c}"/> <apex:column value="{!acc.Event_Name__c}"/> <apex:column value="{!acc.evt_Des__c}"/> <apex:column value="{!acc.Address1__c}"/> <apex:column value="{!acc.Address2__c}"/> <apex:column value="{!acc.City__c}"/> <apex:column value="{!acc.Country__c}"/> <apex:column value="{!acc.State_Province__c}"/> <apex:column value="{!acc.Zip_Code__c}"/> <apex:column value="{!acc.Dt_Ti__c}"/> <apex:column value="{!acc.Ct_Person__c}"/> <apex:column value="{!acc.Ph_Num__c}"/> </apex:pageblockTable> </apex:pageBlock> </apex:form> </apex:page>
Thanks
Sivapriyaa M S
Brian Cherry FWI
Instead of using MailingCountryCode use MailingCountry