• RAM R
  • NEWBIE
  • 50 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 5
    Replies
for(Contact c: contactList){
            for(Addresses__c a: addressList){
                if(a.Contact__c == c.Id){
                    if(zipcodeMap.containsKey(string.valueOf(a.Zip_Code__c+''+c.Firm_Channel__c))){
values---------->  conZipMap.put(a.Contact__c ,  zipcodeMap.get(string.valueOf(a.Zip_Code__c+''+c.Firm_Channel__c)));                        
                        system.debug('&&&&&' + conZipMap);
                        system.debug('&&&&&' + a.Zip_Code__c+''+c.Firm_Channel__c);                        
                    }
                } 
            }
        }
        for(Contact c: contactList){
            if(!conZipMap.containsKey(c.Zip_Code__c)){
                if((c.Firm_Channel__c != null)&&(c.Firm_Channel__c != contactOldMap.get(c.Id).Firm_Channel__c)){                    
                    system.debug('*****'+conZipMap.get(c.Zip_Code__c);
     -------->         c.Zip_Code__c = conZipMap.get(c.Zip_Code__c);-----------> how can i  call the above map and assigned that zipcode here 
                    system.debug('&&&&&&&' + c.Zip_Code__c);
                    system.debug('&&&&&&&' + conZipMap.get(c.Zip_Code__c).Id);
                }
            }
        }
  • December 09, 2015
  • Like
  • 0
Hello,
I have 3 objects zipcode , address, contact.
---contact have one physical address & contact have firem channel 
---address have one zipcode(text)
---zipcode have zip and territory channel 

i am facing de reference null object please suggest me if any one knows and find below my code....

Public void populateZoneZipTerritory(List<Contact> contactList , Map<Id, Contact> contactOldMap){
        set<Id> contId = new set<Id>();
        set<string> zipcodeName = new set<string>();
        set<string> firmChannel = new set<string>();
        Map<string, Zip_Code__c> zipcodeMap = new Map<string, Zip_Code__c>();
        Map<Id, Contact> contMap = new Map<Id, Contact>();
        for(Contact c : contactList){
            if((c.Firm_Channel__c != null)&&(c.Firm_Channel__c != contactOldMap.get(c.Id).Firm_Channel__c)){
                contId.add(c.Id);
                firmChannel.add(c.Firm_Channel__c);
                contMap.put(c.Id, c);
                system.debug('*******'+contMap);
            }
        }
        List<Addresses__c> addressList =  new List<Addresses__c>([select Id, Zip_Code__c, Contact__c, Address_Type__c from Addresses__c where Address_Type__c = 'Physical' and Contact__c IN :contId]);
        for(Addresses__c a: addressList){
            zipcodeName.add(a.Zip_Code__c);
        }
        List<Zip_Code__c> zipcodeList = new List<Zip_Code__c>([select Id,Name,Zone__c,Zone__r.Territory__c,Territory_Channel__c from Zip_Code__c where Name IN :zipcodeName and Territory_Channel__c IN :firmChannel]);
        for(Zip_Code__c z :zipcodeList){
            zipcodeMap.put(z.Name+''+z.Territory_Channel__c, z);
            system.debug('******'+ zipcodeMap);
        }
        Map<Id, Zip_Code__c> conZipMap = new Map<Id, Zip_Code__c>();       
        for(Contact c: contactList){
            for(Addresses__c a: addressList){
                if(a.Contact__c == c.Id){
                    if(zipcodeMap.containsKey(string.valueOf(a.Zip_Code__c+''+c.Firm_Channel__c))){
                        conZipMap.put(a.Contact__c ,  zipcodeMap.get(a.Zip_Code__c+''+c.Firm_Channel__c));                        
                        system.debug('&&&&&' + conZipMap);
                        system.debug('&&&&&' + a.Zip_Code__c+''+c.Firm_Channel__c);--------------> // i got the value here
                        system.debug('^^^^^^^^'+conZipMap.containsKey(c.Zip_Code__c));
                    }
                } 
            }
        }
        for(Contact c: contactList){
            if(!conZipMap.containsKey(c.Zip_Code__c)){
                if((c.Firm_Channel__c != null)&&(c.Firm_Channel__c != contactOldMap.get(c.Id).Firm_Channel__c)){
                    c.Zip_Code__c = conZipMap.get(c.Zip_Code__c).Id;------------------->// i need to update zipcode here
                    system.debug('&&&&&&&' + c.Zip_Code__c);
                    system.debug('&&&&&&&' + conZipMap.get(c.Zip_Code__c).Id);
                }
            }
        }
    }
  • December 09, 2015
  • Like
  • 0
HI , i am facing de-reference null object please suggest me the solution and find below my code..

trigger zipcodeupdateTrigger on Contact (after insert, after update) {
    set<string> zipcodeName = new set<string>();
    set<string> firmchannelName = new set<string>();
    Map<Id, Zipcode__c> zipCodeMap = new Map<Id, Zipcode__c>();
    List<Contact> updateList = new List<Contact>();
    
    //Map<Id, Address__C> addressMap = new Map<Id, Address__C>();
    List<Address__C> addressList = new List<Address__C>([select id, Name, contact_Level__C, zipcode__c from Address__c where type__C = 'physical']);
    for(Address__c a:addressList){
        //addressMap.put(a.zipcode__C, a);
        firmchannelName.add(a.contact_level__c);
        zipcodeName.add(a.Zipcode__c);
    }
    List<Zipcode__C> zipList = new List<zipcode__c>([select id, Name from Zipcode__c where Name IN :zipcodeName]);
    for(Zipcode__c z: zipList){
        zipCodeMap.put(z.Id, z);
    }
    for(Contact c:trigger.New){
        Zipcode__C zp = zipcodeMap.get(c.zipcode__c);------------------->i am not able to get the value?
        if((c.Level__c != null) && (c.Level__c != trigger.oldMap.get(c.Id).Level__C)){
            system.debug('********* : '+ zp.Name);
            c.zipcode__c = zp.Name;
            updateList.add(c);
            system.debug('********* : '+ zp.Name);
        }
    }
    Update updateList;
}
  • December 08, 2015
  • Like
  • 0
please suggest me , how to get this account from client org to my org using rest api through '/services/data/v35.0/query' endpoint?
Account accounts = [SELECT id from Account where Name ='sree'];
    req.setMethod('GET');
    req.setHeader('Authorization' , 'Autorization: Bearer' + accessToken);
    req.setHeader('Content-Type','application/json; charset=utf-8' );
    req.setEndpoint(instanceUrl+'/services/data/v35.0/query?'+accounts);
    Http http2 = new Http();
    HTTPResponse res2 = http2.send(req);   
    System.debug('****************res2.getbody(): '+res2.getbody());
  • December 07, 2015
  • Like
  • 0
Please suggest me if anyone knows "I have written a web services in my personal org, that is sum of two parameters but i need to pass two parameters from another salesforce org and i need to give authentication as well" ?

@RestResource(urlMapping='/addParameters/*')
global with sharing class REST_addParameters{
@HttpPost 
global static Integer doParamsTest(Integer parameterone, Integer parametertwo) {     
     Integer sum = 0;     
     sum = parameterone + parametertwo;    
    return sum;
    }  
}
  • November 28, 2015
  • Like
  • 0
please suggest me if any one knows how can i achieve this requirement.

I want to check name case insensitive.
find below my code.
Public void UpdateStageNameSample(List<Opportunity> oppList){       
        List<Opportunity> optyList = new List<Opportunity>();
        String s = 'valued client';       
        for(Opportunity opp: oppList){
            if(opp.Name.contains(s.toUpperCase())){                
                opp.StageName = 'Sample';                           
            }
        }       
    }
  • November 25, 2015
  • Like
  • 0
Can any one provide me code for clone the contact record if i have changed account value in the contact object .

and i want to see old record and cloned record here cloned record should be with new account Name.

i have tried this but not reached.
trigger cloneTrigger on Contact (after insert) {
    set<id> oid = new set<id>();
    for(Contact c : Trigger.new){
        if(c.Name == 'Test'){
            oid.add(c.Id);
            System.debug('cloningvalues:' + oid);
        }
    }
    list<Contact> olist = [select id,Name from Contact Where Id in:oid];
     map<id, contact> oldmap = new map<id, contact>([select id, name, contact.accountid from contact where id IN: oid]);  
      for(Contact ct :olist){
         Contact cont = new Contact();
          if(cont.Account != oldmap.get(cont.id).account)
          cont.Account = oldmap.get(cont.id).account;
        insert cont;
      }
 }

 
  • October 30, 2015
  • Like
  • 0
Hello,
I have 3 objects zipcode , address, contact.
---contact have one physical address & contact have firem channel 
---address have one zipcode(text)
---zipcode have zip and territory channel 

i am facing de reference null object please suggest me if any one knows and find below my code....

Public void populateZoneZipTerritory(List<Contact> contactList , Map<Id, Contact> contactOldMap){
        set<Id> contId = new set<Id>();
        set<string> zipcodeName = new set<string>();
        set<string> firmChannel = new set<string>();
        Map<string, Zip_Code__c> zipcodeMap = new Map<string, Zip_Code__c>();
        Map<Id, Contact> contMap = new Map<Id, Contact>();
        for(Contact c : contactList){
            if((c.Firm_Channel__c != null)&&(c.Firm_Channel__c != contactOldMap.get(c.Id).Firm_Channel__c)){
                contId.add(c.Id);
                firmChannel.add(c.Firm_Channel__c);
                contMap.put(c.Id, c);
                system.debug('*******'+contMap);
            }
        }
        List<Addresses__c> addressList =  new List<Addresses__c>([select Id, Zip_Code__c, Contact__c, Address_Type__c from Addresses__c where Address_Type__c = 'Physical' and Contact__c IN :contId]);
        for(Addresses__c a: addressList){
            zipcodeName.add(a.Zip_Code__c);
        }
        List<Zip_Code__c> zipcodeList = new List<Zip_Code__c>([select Id,Name,Zone__c,Zone__r.Territory__c,Territory_Channel__c from Zip_Code__c where Name IN :zipcodeName and Territory_Channel__c IN :firmChannel]);
        for(Zip_Code__c z :zipcodeList){
            zipcodeMap.put(z.Name+''+z.Territory_Channel__c, z);
            system.debug('******'+ zipcodeMap);
        }
        Map<Id, Zip_Code__c> conZipMap = new Map<Id, Zip_Code__c>();       
        for(Contact c: contactList){
            for(Addresses__c a: addressList){
                if(a.Contact__c == c.Id){
                    if(zipcodeMap.containsKey(string.valueOf(a.Zip_Code__c+''+c.Firm_Channel__c))){
                        conZipMap.put(a.Contact__c ,  zipcodeMap.get(a.Zip_Code__c+''+c.Firm_Channel__c));                        
                        system.debug('&&&&&' + conZipMap);
                        system.debug('&&&&&' + a.Zip_Code__c+''+c.Firm_Channel__c);--------------> // i got the value here
                        system.debug('^^^^^^^^'+conZipMap.containsKey(c.Zip_Code__c));
                    }
                } 
            }
        }
        for(Contact c: contactList){
            if(!conZipMap.containsKey(c.Zip_Code__c)){
                if((c.Firm_Channel__c != null)&&(c.Firm_Channel__c != contactOldMap.get(c.Id).Firm_Channel__c)){
                    c.Zip_Code__c = conZipMap.get(c.Zip_Code__c).Id;------------------->// i need to update zipcode here
                    system.debug('&&&&&&&' + c.Zip_Code__c);
                    system.debug('&&&&&&&' + conZipMap.get(c.Zip_Code__c).Id);
                }
            }
        }
    }
  • December 09, 2015
  • Like
  • 0
Please suggest me if anyone knows "I have written a web services in my personal org, that is sum of two parameters but i need to pass two parameters from another salesforce org and i need to give authentication as well" ?

@RestResource(urlMapping='/addParameters/*')
global with sharing class REST_addParameters{
@HttpPost 
global static Integer doParamsTest(Integer parameterone, Integer parametertwo) {     
     Integer sum = 0;     
     sum = parameterone + parametertwo;    
    return sum;
    }  
}
  • November 28, 2015
  • Like
  • 0
please suggest me if any one knows how can i achieve this requirement.

I want to check name case insensitive.
find below my code.
Public void UpdateStageNameSample(List<Opportunity> oppList){       
        List<Opportunity> optyList = new List<Opportunity>();
        String s = 'valued client';       
        for(Opportunity opp: oppList){
            if(opp.Name.contains(s.toUpperCase())){                
                opp.StageName = 'Sample';                           
            }
        }       
    }
  • November 25, 2015
  • Like
  • 0
Hi All,

Am brand new to Salesforce and trying to send list of records in bathces(say 3000 records per batch). And my requirement is to send first 3000 records as a json string to third party API and get a response. If the response is success, then i need to send next 3000 records as json string again. Can anyone help me in sending the data as batches. If i get a response other success, i should not send the remaining data to API.

Thanks in advance.