• EricSSH
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies
Recently It has been requested by my manager to begin handling all Salesforce development requests in order to not have to hire outside help from consultants, so he told me to begin doing research for some courses so I will be able to handle these requests more effectively.

I know this question is subjective and I would actually like to hear your experiences and opinions. It looks like I will primarily be working with more of the "back-end" aspect of Sales force and won't need to have a great deal of requests for Visual force yet. So as long as admins don't have an issue with subjective and opinionated answers, I would like to hear what you guys have to say.

So to sum it up, How do I get started?
Some quick background of what Im trying to do..

The following is my Apex Trigger. It is a validation Trigger on Sampling_c which will validate that Country_c is a Valid country using Validation_country_c. When it validates Country_c it will look into State_province_c and will then validate that it is actually a state So .. If Country_c = US and State_province_c = CA then we are okay. But IF Country_c = US and State_province_c = ZZ221(whatever) it should fail. Now these condition checks only triggers when Override_c = 'Yes'.

I've also written a test class that is ignoring some lines, but  I will work one issue at a time.

validCountries.get( obj.Transportation_Zone__c,obj ); This line is breaking, but I believe its happening because of 

--

Map<String, Validation_Country__c> validCountries = new Map<String, Validation_Country__c>();

The Error that I'm getting is --
Method does not exist or incorrect signature: [MAP<String,Validation_Country__c>].get(String, SOBJECT:Validation_Country__c)

Can anyone give me some guidance?

trigger OverrideTrigger on Sampling__c (before insert,before update) {

// Top level map is keyed by Country. Inner Map is keyed by Region
    Map<String, Validation_Country__c> validCountries = new Map<String, Validation_Country__c>();
    Map<String, Map<String, Validation_Region__c>> validRegions = new Map<String, Map<String, Validation_Region__c>>();
// ...

   For(Validation_Country__c obj : [Select Id,Country_Name__c,Transportation_Zone__c FROM Validation_Country__c]){
        validCountries.get( obj.Transportation_Zone__c,obj );
        System.debug(validCountries);
              
    }
   
For(Validation_Region__c objR : [Select Id,Country_Key__c,Description__c,Name FROM Validation_Region__c]){

    String countryKey = objR.Country_Key__c;

    Map<String, Validation_Region__c> regionMap = validRegions.get(countryKey);
    // Maybe rework to use Map.containsKey rather than null check. Would be cleaner.
   
    if(regionMap == null) {
        regionMap = new Map<String, Validation_Region__c>();
        validRegions.put(countryKey, regionMap);
    }
    string regionKey = objR.Description__c;
    regionMap.put( regionKey,objR);
    }


For( Sampling__c s : Trigger.new){
    If((s.Country__c != null) && (S.Override__c == 'Yes')){
        String countryKey = s.Country__c;
        String regionKey = s.State_Province__c;
 
       // If(validCountries.containsKey(countryKey) && validRegions.containsKey(countryKey)) {
            // The country appears to be valid and there are possible Region matches
          //  Validation_Country__c vc = validCountries.get(countryKey);
              
            If(validRegions.get(countryKey).containsKey(regionKey)) {
                // The Region belongs to the country
                Validation_Region__c vr = validRegions.get(countryKey).get(regionKey);
             }
   
         }
     }
}
I'm creating a trigger to do some validations and I have a map that is Country_Key__c, Description_Name__c, Name.  I would like to get them all into a map so I can do some validations.  I have googled and search this form for some answers, but I am very new to Salesforce and Apex and do not grasp many of the concepts..  I would like to create these maps to do be multidimensional..

trigger OverrideAddressTrigger on Sampling__c (before insert) {
    

 
    Map<String, Validation_Country__c> validCountries = new Map<String, Validation_Country__c>();
    Map<String, Validation_Region__c> validRegions = new Map<String, Validation_Region__c>();
   
    //Getting Country Validation.
    For(Validation_Country__c obj : [Select Id,Country_Name__c,Transportation_Zone__C FROM Validation_Country__c]){
        validCountries.put( obj.Country_Name__c,obj);
}
    //Getting Region Validation
    For(Validation_Region__c objR : [Select Id,Country_Key__c,Description__c,Name FROM Validation_Region__c]){
        validRegions.put( objR.Description__c,objR);
        validRegions.put( objR.Country_Key__c,objR);
}
   
    For( Sampling__c s : Trigger.new){
        IF(s.Country__c != null){
            IF(validRegions.containsKey(s.Country__c) && (validRegions.contains(s.State_Province__c)){//Not quite right.. logic? 
                s.Country__c == validCountries.get(s.Country__c);//Wrong needs fixing
               
               
        }
    }
   }
}


Hello All,
I have been assigned a pretty daunting task to create a validation trigger for Ship to information.  I am very stressed out considering I have 0 experince inside the Salesforce enviroment.  Requirements below..

-------------
This support is needed on the Sampling__c object.
When saved with field Override__c = "Yes", we need to verify
1. that values entered in the Country__c field are are restricted to those listed on the attached file on the first tab in the Valid Country Codes column (column A)
2. that values in the State_Province__c field are restricted to those listed as valid for the entered Country__c value as noted on the second tab (column C lists valid options for the Country Code listed in column A)
3. that values entered in the Zip_Postal_Code__c field adhere to the attached rules for the entered Country__c as noted on the first tab (columns D, E and F indicate the rule for the Country Code listed in column A)
4. that values entered in the SAP_Transportation_Zone__c field are restricted to those listed as valid for the entered Country__c value as noted on the first tab (column c) – in fact if your trigger instead could auto-populate this field based on what is valid for the country code the user selects in the  Country__c field, that would be even better!

We are not able to accomplished this via dependent picklists as we feed these fields from our lead convert and custom address object and need to allow users to freely type values in those objects. We only want this validation to take place once the Sample record is saved with Override__c = "Yes" as stated above.----------

I will almost post the code that I have so far.   You guys have a load more of experince than I do so if you can think of a better way to do it please feel free to tell me..  Any insite is appericatied. 

trigger OverrideAddressTrigger on Sampling__c (before insert) {
     //String[] countryCodeZero = new String[]{'AD','AE','AF','AG','AI','AL','AM','AN','AO','AQ','AS','AW','AZ','BA','BB','BD','BF','BG','BH','BI','BJ','BM','BN','BO','BS','BT','BV','BW','BY','BZ','CC','CD','CF','CG','CI','CK','CM','CU','CV','CX','DJ','DM','DO','EC','EE','EG','EH','ER','ET','FJ','FK','FM','GA','GD','GE','GF','GH','GI','GL','GM','GN','GP','GQ','GS','GT','GU','GW','GY','HM','HN','HT','IO','IQ','JM','JO','KE','KG','KH','KI','KM','KN','KY','LA','LB','LC','LK','LR','LT','LY','MA','MD','MG','MH','MK','ML','MM','MN','MO','MP','MQ','MR','MS','MT','MU','MV','MW','MZ','NA','NC','NE','NF','NG','NI','NR','NU','OM','PA','PE','PF','PG','PK','PM','PN','PR','PW','PY','QA','RE','RW','SB','SC','SD','SH','SJ','SL','SM','SN','SO','SR','ST','SV','SY','SZ','TC','TF','TG','TJ','TK','TL','TM','TO','TP','TT','TV','TZ','UG','UM','UZ','VA','VC','VG','VI','VU','WF','WS','YE','YT','ZM','ZW'};
       
     Set<String> countryCodeZero = new Set<String>{'AD','AE','AF','AG','AI','AL','AM','AN','AO','AQ','AS','AW','AZ','BA','BB','BD','BF','BG','BH','BI','BJ','BM','BN','BO','BS','BT','BV','BW','BY','BZ','CC','CD','CF','CG','CI','CK','CM','CU','CV','CX','DJ','DM','DO','EC','EE','EG','EH','ER','ET','FJ','FK','FM','GA','GD','GE','GF','GH','GI','GL','GM','GN','GP','GQ','GS','GT','GU','GW','GY','HM','HN','HT','IO','IQ','JM','JO','KE','KG','KH','KI','KM','KN','KY','LA','LB','LC','LK','LR','LT','LY','MA','MD','MG','MH','MK','ML','MM','MN','MO','MP','MQ','MR','MS','MT','MU','MV','MW','MZ','NA','NC','NE','NF','NG','NI','NR','NU','OM','PA','PE','PF','PG','PK','PM','PN','PR','PW','PY','QA','RE','RW','SB','SC','SD','SH','SJ','SL','SM','SN','SO','SR','ST','SV','SY','SZ','TC','TF','TG','TJ','TK','TL','TM','TO','TP','TT','TV','TZ','UG','UM','UZ','VA','VC','VG','VI','VU','WF','WS','YE','YT','ZM','ZW'};
        System.debug('**********' +countryCodeZero);
        For(Sampling__c S: Trigger.new){
        //Creating the Rules for Zipcodes that have to be larger than 0
        IF((S.Override__c == 'Yes') && (S.Zip_Postal_Code__c.length() > 0)){  
           
            IF(string.ISBLANK(S.Country__c))
            {         
                System.debug('Country is Blank');
                //Do something
            }ELSE IF(string.isNotBlank(S.Country__c)){ 
     IF(countryCodeZero.contains(S.Country__c)
    {
                System.debug('Success!')
                return true;
             }ELSE{
                System.debug('Failure')
                return false;
           }
      }
               
            IF(string.ISBLANK(S.City__c))
            {
             System.debug('City is blank');
                //Do something
            }ELSE IF(string.isNotBlank(S.City__c)){
               //Do Stuff
            }
    
   IF(string.ISBLANK(S.State_Province__c))
            {
               System.debug('Province is blank');
                //Do something
            }ELSE IF(string.isNotBlank(S.State_Province__c)){
                //Do stuff
            }
            IF(string.ISBLANK(S.Zip_Postal_Code__c))
            {
             System.debug('Zip code is blank');
                //Do something
            }ElSE IF(S.Zip_Postal_Code__c != NULL){
                    System.debug('Zipcode filled');
            }ElSE{
              System.debug('Zipcode is Empty');
               
            }
                
            }
        }
    }
}
Recently It has been requested by my manager to begin handling all Salesforce development requests in order to not have to hire outside help from consultants, so he told me to begin doing research for some courses so I will be able to handle these requests more effectively.

I know this question is subjective and I would actually like to hear your experiences and opinions. It looks like I will primarily be working with more of the "back-end" aspect of Sales force and won't need to have a great deal of requests for Visual force yet. So as long as admins don't have an issue with subjective and opinionated answers, I would like to hear what you guys have to say.

So to sum it up, How do I get started?
I'm creating a trigger to do some validations and I have a map that is Country_Key__c, Description_Name__c, Name.  I would like to get them all into a map so I can do some validations.  I have googled and search this form for some answers, but I am very new to Salesforce and Apex and do not grasp many of the concepts..  I would like to create these maps to do be multidimensional..

trigger OverrideAddressTrigger on Sampling__c (before insert) {
    

 
    Map<String, Validation_Country__c> validCountries = new Map<String, Validation_Country__c>();
    Map<String, Validation_Region__c> validRegions = new Map<String, Validation_Region__c>();
   
    //Getting Country Validation.
    For(Validation_Country__c obj : [Select Id,Country_Name__c,Transportation_Zone__C FROM Validation_Country__c]){
        validCountries.put( obj.Country_Name__c,obj);
}
    //Getting Region Validation
    For(Validation_Region__c objR : [Select Id,Country_Key__c,Description__c,Name FROM Validation_Region__c]){
        validRegions.put( objR.Description__c,objR);
        validRegions.put( objR.Country_Key__c,objR);
}
   
    For( Sampling__c s : Trigger.new){
        IF(s.Country__c != null){
            IF(validRegions.containsKey(s.Country__c) && (validRegions.contains(s.State_Province__c)){//Not quite right.. logic? 
                s.Country__c == validCountries.get(s.Country__c);//Wrong needs fixing
               
               
        }
    }
   }
}


Hello All,
I have been assigned a pretty daunting task to create a validation trigger for Ship to information.  I am very stressed out considering I have 0 experince inside the Salesforce enviroment.  Requirements below..

-------------
This support is needed on the Sampling__c object.
When saved with field Override__c = "Yes", we need to verify
1. that values entered in the Country__c field are are restricted to those listed on the attached file on the first tab in the Valid Country Codes column (column A)
2. that values in the State_Province__c field are restricted to those listed as valid for the entered Country__c value as noted on the second tab (column C lists valid options for the Country Code listed in column A)
3. that values entered in the Zip_Postal_Code__c field adhere to the attached rules for the entered Country__c as noted on the first tab (columns D, E and F indicate the rule for the Country Code listed in column A)
4. that values entered in the SAP_Transportation_Zone__c field are restricted to those listed as valid for the entered Country__c value as noted on the first tab (column c) – in fact if your trigger instead could auto-populate this field based on what is valid for the country code the user selects in the  Country__c field, that would be even better!

We are not able to accomplished this via dependent picklists as we feed these fields from our lead convert and custom address object and need to allow users to freely type values in those objects. We only want this validation to take place once the Sample record is saved with Override__c = "Yes" as stated above.----------

I will almost post the code that I have so far.   You guys have a load more of experince than I do so if you can think of a better way to do it please feel free to tell me..  Any insite is appericatied. 

trigger OverrideAddressTrigger on Sampling__c (before insert) {
     //String[] countryCodeZero = new String[]{'AD','AE','AF','AG','AI','AL','AM','AN','AO','AQ','AS','AW','AZ','BA','BB','BD','BF','BG','BH','BI','BJ','BM','BN','BO','BS','BT','BV','BW','BY','BZ','CC','CD','CF','CG','CI','CK','CM','CU','CV','CX','DJ','DM','DO','EC','EE','EG','EH','ER','ET','FJ','FK','FM','GA','GD','GE','GF','GH','GI','GL','GM','GN','GP','GQ','GS','GT','GU','GW','GY','HM','HN','HT','IO','IQ','JM','JO','KE','KG','KH','KI','KM','KN','KY','LA','LB','LC','LK','LR','LT','LY','MA','MD','MG','MH','MK','ML','MM','MN','MO','MP','MQ','MR','MS','MT','MU','MV','MW','MZ','NA','NC','NE','NF','NG','NI','NR','NU','OM','PA','PE','PF','PG','PK','PM','PN','PR','PW','PY','QA','RE','RW','SB','SC','SD','SH','SJ','SL','SM','SN','SO','SR','ST','SV','SY','SZ','TC','TF','TG','TJ','TK','TL','TM','TO','TP','TT','TV','TZ','UG','UM','UZ','VA','VC','VG','VI','VU','WF','WS','YE','YT','ZM','ZW'};
       
     Set<String> countryCodeZero = new Set<String>{'AD','AE','AF','AG','AI','AL','AM','AN','AO','AQ','AS','AW','AZ','BA','BB','BD','BF','BG','BH','BI','BJ','BM','BN','BO','BS','BT','BV','BW','BY','BZ','CC','CD','CF','CG','CI','CK','CM','CU','CV','CX','DJ','DM','DO','EC','EE','EG','EH','ER','ET','FJ','FK','FM','GA','GD','GE','GF','GH','GI','GL','GM','GN','GP','GQ','GS','GT','GU','GW','GY','HM','HN','HT','IO','IQ','JM','JO','KE','KG','KH','KI','KM','KN','KY','LA','LB','LC','LK','LR','LT','LY','MA','MD','MG','MH','MK','ML','MM','MN','MO','MP','MQ','MR','MS','MT','MU','MV','MW','MZ','NA','NC','NE','NF','NG','NI','NR','NU','OM','PA','PE','PF','PG','PK','PM','PN','PR','PW','PY','QA','RE','RW','SB','SC','SD','SH','SJ','SL','SM','SN','SO','SR','ST','SV','SY','SZ','TC','TF','TG','TJ','TK','TL','TM','TO','TP','TT','TV','TZ','UG','UM','UZ','VA','VC','VG','VI','VU','WF','WS','YE','YT','ZM','ZW'};
        System.debug('**********' +countryCodeZero);
        For(Sampling__c S: Trigger.new){
        //Creating the Rules for Zipcodes that have to be larger than 0
        IF((S.Override__c == 'Yes') && (S.Zip_Postal_Code__c.length() > 0)){  
           
            IF(string.ISBLANK(S.Country__c))
            {         
                System.debug('Country is Blank');
                //Do something
            }ELSE IF(string.isNotBlank(S.Country__c)){ 
     IF(countryCodeZero.contains(S.Country__c)
    {
                System.debug('Success!')
                return true;
             }ELSE{
                System.debug('Failure')
                return false;
           }
      }
               
            IF(string.ISBLANK(S.City__c))
            {
             System.debug('City is blank');
                //Do something
            }ELSE IF(string.isNotBlank(S.City__c)){
               //Do Stuff
            }
    
   IF(string.ISBLANK(S.State_Province__c))
            {
               System.debug('Province is blank');
                //Do something
            }ELSE IF(string.isNotBlank(S.State_Province__c)){
                //Do stuff
            }
            IF(string.ISBLANK(S.Zip_Postal_Code__c))
            {
             System.debug('Zip code is blank');
                //Do something
            }ElSE IF(S.Zip_Postal_Code__c != NULL){
                    System.debug('Zipcode filled');
            }ElSE{
              System.debug('Zipcode is Empty');
               
            }
                
            }
        }
    }
}