• sriram anil
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 3
    Replies
I am enter input:INDIA, output display cities in country. but not showing data how to solve any one explain
vfpage:
======
<apex:page controller="Searchwether">
<apex:form>
ENTER COUNTRYNAME:<apex:inputText value="{!CountryName}"/><br/>
<apex:commandButton value="Submit" action="{!GetCities}"/>

OUTPUT CityName:<apex:outputText value="{!CityName}"/>

</apex:form>
</apex:page>
APEXCLASS:
==========
//Generated by wsdl2apex
public class Searchwether {
 public String CountryName{get;set;}
 public String CityName{get;set;}
 public void GetCities(){
 
   Searchwether.GlobalWeatherSoap wrs = new Searchwether.GlobalWeatherSoap();
   string s = wrs.GetCitiesByCountry('CountryName');
  
   CityName=s ;
 
 
 
 }
    public class GetWeather_element {
        public String CityName;
        public String CountryName;
       
        private String[] CityName_type_info = new String[]{'CityName','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] CountryName_type_info = new String[]{'CountryName','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'CityName','CountryName'};
    }
    public class GetCitiesByCountry_element {
        public String CountryName;
        private String[] CountryName_type_info = new String[]{'CountryName','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'CountryName'};
    }
    public class GetWeatherResponse_element {
        public String GetWeatherResult;
        private String[] GetWeatherResult_type_info = new String[]{'GetWeatherResult','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'GetWeatherResult'};
    }
    public class GetCitiesByCountryResponse_element {
        public String GetCitiesByCountryResult;
        private String[] GetCitiesByCountryResult_type_info = new String[]{'GetCitiesByCountryResult','http://www.webserviceX.NET',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.webserviceX.NET','true','false'};
        private String[] field_order_type_info = new String[]{'GetCitiesByCountryResult'};
    }
    public class GlobalWeatherSoap {
        public String endpoint_x = 'http://www.webservicex.net/globalweather.asmx';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://www.webserviceX.NET', 'Searchwether'};
        public String GetCitiesByCountry(String CountryName) {
            Searchwether.GetCitiesByCountry_element request_x = new Searchwether.GetCitiesByCountry_element();
            request_x.CountryName = CountryName;
            Searchwether.GetCitiesByCountryResponse_element response_x;
            Map<String, Searchwether.GetCitiesByCountryResponse_element> response_map_x = new Map<String, Searchwether.GetCitiesByCountryResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.webserviceX.NET/GetCitiesByCountry',
              'http://www.webserviceX.NET',
              'GetCitiesByCountry',
              'http://www.webserviceX.NET',
              'GetCitiesByCountryResponse',
              'Searchwether.GetCitiesByCountryResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetCitiesByCountryResult;
        }
        public String GetWeather(String CityName,String CountryName) {
            Searchwether.GetWeather_element request_x = new Searchwether.GetWeather_element();
            request_x.CityName = CityName;
            request_x.CountryName = CountryName;
            Searchwether.GetWeatherResponse_element response_x;
            Map<String, Searchwether.GetWeatherResponse_element> response_map_x = new Map<String, Searchwether.GetWeatherResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://www.webserviceX.NET/GetWeather',
              'http://www.webserviceX.NET',
              'GetWeather',
              'http://www.webserviceX.NET',
              'GetWeatherResponse',
              'Searchwether.GetWeatherResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.GetWeatherResult;
        }
    }
}
id(autogenerated)            name
---------------------------------------------
a-001                          aaa
a-002                          bbb
a-003                          ccc
-------------------------------------------
the above table i am delete  a002 and a003 records, again insert another record ,this time automatically start with  a002

how to write trigger  above program any one pls forward code
id(autogenerated)            name
---------------------------------------------
a-001                          aaa
a-002                          bbb
a-003                          ccc
-------------------------------------------
the above table i am delete  a002 and a003 records, again insert another record ,this time automatically start with  a002

how to write trigger  any one explain

I am creating custom setting Object 1st
in this object Country_barcodes__c two field creating
1is country_phone_code__c---->country phone codes
2nd country barcode---->like Ex:Name:INDIA---->barcode-Ind

i am insert  new record into account
BillingCountry is i am enter india automatically phone field also show phonecode like 91
=========================================================================
Trigger basicTrigger on account(before insert,before update){
    
    if(trigger.isbefore && Trigger.isInsert){
        
        List<Country_barcodes__c> mcs = Country_barcodes__c.getall().values();

        Map<integer,String> countryWithPhone = New Map<integer,String>();
         
        for(integer i=0;i<mcs.size();i++){
            countryWithPhone.put(mcs[i].country_phone_code__c,mcs[i].Name);
        }
        
         
        for(integer i=0;i<trigger.new.size();i++){
            if(countryWithPhone.ContainsKey(Trigger.new[i].BillingCountry)){
                trigger.new[i].Phone = countryWithPhone.get(Trigger.new[i].BillingCountry);
            }else{
                trigger.new[i].BillingCountry.addError('COUNTRY CODE DOES NOT EXISTS');
            }
        }
    }
  
}

 
any one pls explain and solve this error:


Trigger basicTrigger on account(before insert,before update){
    
    if(trigger.isbefore && Trigger.isInsert){
        
        List<Country_barcodes__c> mcs = Country_barcodes__c.getall().values();

        Map<integer,String> countryWithPhone = New Map<integer,String>();
         
        for(integer i=0;i<mcs.size();i++){
            countryWithPhone.put(mcs[i].country_phone_code__c,mcs[i].Name);
        }
        
         
        for(integer i=0;i<trigger.new.size();i++){
            if(countryWithPhone.ContainsKey(Trigger.new[i].BillingCountry)){
                trigger.new[i].Phone = countryWithPhone.get(Trigger.new[i].BillingCountry);
            }else{
                trigger.new[i].BillingCountry.addError('COUNTRY CODE DOES NOT EXISTS');
            }
        }
    }
  
}
I am using feild sets in this program but error occcure in this program and pls give suggestion

public class CreateMultiplePatients{
    ID DoctorID;
    public Doctor__c docObj{get;set;}
    
    public List<Patient__c> multiplePatients{get;set;}
    
    public CreateMultiplePatients(ApexPages.StandardController varName){
        multiplePatients = New List<Patient__c>();
        
        DoctorID = apexpages.currentpage().getparameters().get('id');
        
      //  docObj = [SELECT id,name,daysworking__c,Joining_Year__c,Salary__c,specialization__c FROM Doctor__c where id=:DoctorID];      
     
     
     
        String validateQuery = 'SELECT id';
        for(Schema.FieldSetMember fld :SObjectType.Doctor__c .FieldSets.Doctor_feild.getFields()) {
                 validateQuery += ', ' + fld.getFieldPath();
        }
        validateQuery += ' from Doctor__c WHERE id=:DoctorID';
        
        docObj = dataBase.Query(validateQuery);
     
     
        Patient__c newpatient = New Patient__c();
        multiplePatients.add(newpatient);
    
    }
    
    public void addRow(){
         Patient__c newpatient = New Patient__c();
         multiplePatients.add(newpatient);
    }
    
    public pageReference saveMultiplepatients(){
        for(integer i=0;i<multiplePatients.size();i++){
           multiplePatients[i].TreatmentDoctor__c = DoctorID;
          //ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'Error Message.'));

        }
        insert multiplePatients;
        
        pageReference pagref = New pageReference('/'+DoctorID);
        return pagref;       
    }    
 public void RemoveRow(){
        integer i = multiplePatients.size();
        multiplePatients.remove(i-1);
    }


}
This my apexclass:
------------------------------
Public class CreateMultiplePatients{
ID DoctorID;

public Doctor__c docObj{get;set;}
public List<Patient__c> multiplePatients{get;set;}

public CreateMultiplePatients(ApexPages.StandardController varName){
multiplePatients = New List<Patient__c>();
DoctorID = apexpages.currentpage().getparameters().get('id');
 docObj = [SELECT id,name,Address__c,daysworking__c,Salary__c,Joining_Year__c,specialization__c FROM Doctor__c where id=:DoctorID];
       
        Patient__c newpatient = New Patient__c();
        multiplePatients.add(newpatient);


}
public void addRow(){
         Patient__c newpatient = New Patient__c();
         multiplePatients.add(newpatient);
    }
 public void saveMultiplepatients(){
        for(integer i=0;i<multiplePatients.size();i++){
           / multiplePatients[i].Doctor__c =DoctorID;
        }
        insert multiplePatients;
        
        
}
}
any one pls explain and solve this error:


Trigger basicTrigger on account(before insert,before update){
    
    if(trigger.isbefore && Trigger.isInsert){
        
        List<Country_barcodes__c> mcs = Country_barcodes__c.getall().values();

        Map<integer,String> countryWithPhone = New Map<integer,String>();
         
        for(integer i=0;i<mcs.size();i++){
            countryWithPhone.put(mcs[i].country_phone_code__c,mcs[i].Name);
        }
        
         
        for(integer i=0;i<trigger.new.size();i++){
            if(countryWithPhone.ContainsKey(Trigger.new[i].BillingCountry)){
                trigger.new[i].Phone = countryWithPhone.get(Trigger.new[i].BillingCountry);
            }else{
                trigger.new[i].BillingCountry.addError('COUNTRY CODE DOES NOT EXISTS');
            }
        }
    }
  
}
This my apexclass:
------------------------------
Public class CreateMultiplePatients{
ID DoctorID;

public Doctor__c docObj{get;set;}
public List<Patient__c> multiplePatients{get;set;}

public CreateMultiplePatients(ApexPages.StandardController varName){
multiplePatients = New List<Patient__c>();
DoctorID = apexpages.currentpage().getparameters().get('id');
 docObj = [SELECT id,name,Address__c,daysworking__c,Salary__c,Joining_Year__c,specialization__c FROM Doctor__c where id=:DoctorID];
       
        Patient__c newpatient = New Patient__c();
        multiplePatients.add(newpatient);


}
public void addRow(){
         Patient__c newpatient = New Patient__c();
         multiplePatients.add(newpatient);
    }
 public void saveMultiplepatients(){
        for(integer i=0;i<multiplePatients.size();i++){
           / multiplePatients[i].Doctor__c =DoctorID;
        }
        insert multiplePatients;
        
        
}
}