• Praveen Yadavalli 17
  • NEWBIE
  • 10 Points
  • Member since 2016


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 4
    Questions
  • 6
    Replies
I Have 2 sandboxes 1 and 2 i am able to create a project in Ecclipse  for Sandbox 1 but unfortunately for sandbox 2 i am not  able to load my project into ecclipse its coming up to this window and when i click finish button This window is getting dissappered please help.
User-added image
I have a requirement to extract 200k records from salesforce and each record has about 60 fields in it. Is it possible with Data loader ?
Hi 
I have a requiremnt where there is a standard object OPPORTUNITIES we had a business scenario where opportunity name should over ride with the name which is used in field update by using work flow while creation of record. the business got back to me and changed the requiremnt like if the user does not enter any value in the required field on standard opportunity object and try to save it then it should bring the fieldupdate by using workflow or in case2 if user gives some some name it should directly take that name. 

I am good with second scenario by just going in to the work flow and make it checked "every time when record is created" use this work flow the problem comes next how to overcome to save a field (Standard Required field) without giving value in it and make it over ride by field update value, I tried with below code but its not going through. please help me out with your suggestions.

List<Opportunity> lstOpps = new List<Opportunity>();
    Set<Id> setAccountIds = new Set<Id>();
    if(Trigger.isInsert && Trigger.isBefore) {
         for(Opportunity o: Trigger.new){
             lstOpps.add(o);
             setAccountIds.add(o.AccountId);
        if(String.isBlank(o.Name) && !rtMapById.get(o.RecordTypeId).getName().containsIgnoreCase('National')){
            //lstOpps.add(o);
            //setAccountIds.add(o.AccountId);
        //o.Name = rtMapById.get(o.RecordTypeId).getName()+'-'+o.AccountId+'-'+Date.today().format(); 
    }
         }
    Map<Id, Account> mapAccounts = new Map<Id,Account>([select id,name from Account where id in : setAccountIds]);
    for(Opportunity o: Trigger.new){
     o.Name = rtMapById.get(o.RecordTypeId).getName()+'-'+mapAccounts.get(o.AccountId).Name+'-'+Date.today().format(); 
    }



 
I have a callout in salesforce which is used to call the other systems to get the data or send data through continuous integration butthe problem here is when coming to test class i am getting only 61percent of coverage since its not covering the methods used in callout because i use only one method in the trigger handler its covering fine 

Here is the callout code --

public class ZuoraBillingAccountTriggerHandler {
    
  
    // SF-2177
    public static void QueueRetrieveZuoraAccountSoldToInfoQueuedJob() {
        // if another job is already queued don't do anything, otherwise queue another job
        List<AsyncApexJob> jobList = [SELECT Id, Status, ApexClass.Name FROM AsyncApexJob WHERE ApexClass.Name = 'RetrieveZuoraAccountSoldToInfoQueuedJob' AND (Status = 'Holding' OR Status = 'Queued' OR Status = 'Preparing' OR Status = 'Processing') LIMIT 1];
        if (jobList.isEmpty() && !Test.isRunningTest()) {
            System.enqueueJob(new RetrieveZuoraAccountSoldToInfoQueuedJob.QueueableOne());
        }
    }


    // SF-2177
    public static void ModifyNeedToUpdateSoldToContactCheckboxesAndQueueJob(List<Zuora__CustomerAccount__c> newList, Map<Id, Zuora__CustomerAccount__c> oldMap) {

        Boolean queueTheJob = False;

        for (Zuora__CustomerAccount__c newZCA : newList) {
            Zuora__CustomerAccount__c oldZCA = oldMap.get(newZCA.Id);
            
            // CSP-878 if Amount_Past_Due__c changed, set "queue Job" to false  
            if(oldZCA != null && newZCA.Amount_Past_Due__c != oldZCA.Amount_Past_Due__c){

            }
            // if checkbox was selected and is being unchecked, don't do anything; otherwise, check the box and set the "queue job" flag to true
            // also, due to the high number of updates occurring as part of the UpdateZuoraAccountCBSSQueuedJob, DO NOT select the checkbox under that circumstance
            else if (oldZCA != null && !oldZCA.NeedToUpdateSoldToContact__c && !newZCA.NeedToUpdateSoldToContact__c && (newZCA.CBSS_Name__c == oldZCA.CBSS_Name__c && newZCA.CBSS_SalesRepId__c == oldZCA.CBSS_SalesRepId__c)) {
                newZCA.NeedToUpdateSoldToContact__c = True;
                if (!queueTheJob) {
                    queueTheJob = True;
                }
            }
            // also, if the checkbox was already selected set the "queue job" flag to true, just to be safe
            else if (newZCA.NeedToUpdateSoldToContact__c && !queueTheJob) {
                queueTheJob = True;
            }
        }

        if (queueTheJob) {
            QueueRetrieveZuoraAccountSoldToInfoQueuedJob();
        }
    }
    public static void updateZouraFields(List<Zuora__CustomerAccount__c> newList, Map<Id, Zuora__CustomerAccount__c> oldMap) {
     List<Zuora.zObject>  zuoraZObjectList = new List<Zuora.zObject>();
        Set<String> contactIds = new Set<String>();
        Set<String> billingIds = new Set<String>();
     
     for(Zuora__CustomerAccount__c newZCA : newList){
       Zuora__CustomerAccount__c oldZCA = oldMap.get(newZCA.Id);         
            if(oldZCA != null && newZCA.name != oldZCA.name){
                billingIds.add(newZCA.Zuora__Zuora_Id__c);
            }
       if(oldZCA != null && (newZCA.Zuora__BillToWorkPhone__c != oldZCA.Zuora__BillToWorkPhone__c || 
                newZCA.Zuora__BillToName__c != oldZCA.Zuora__BillToName__c ||
                newZCA.Zuora__BillToWorkEmail__c != oldZCA.Zuora__BillToWorkEmail__c ||
                newZCA.Zuora__BillToAddress1__c != oldZCA.Zuora__BillToAddress1__c ||
                newZCA.Zuora__BillToAddress2__c != oldZCA.Zuora__BillToAddress2__c ||
                newZCA.Zuora__BillToCity__c != oldZCA.Zuora__BillToCity__c ||
                newZCA.Zuora__BillToState__c != oldZCA.Zuora__BillToState__c ||
                newZCA.Zuora__BillToPostalCode__c != oldZCA.Zuora__BillToPostalCode__c ||
                newZCA.Zuora__BillToCountry__c != oldZCA.Zuora__BillToCountry__c)){
         /*Zuora.zObject acc = new Zuora.zObject('Contact');
        acc.setValue('Id', newZCA.Zuora__BillToId__c);
        acc.setValue('WorkPhone', String.isNotBlank(newZCA.Zuora__BillToWorkPhone__c) ? newZCA.Zuora__BillToWorkPhone__c : '');
         */    
        contactIds.add(newZCA.Zuora__BillToId__c);  
               //contactIds.add(newZCA.Zuora__SoldToId__c);                    
              
     }   
     
    }
        if(!(System.isFuture() || System.isBatch())){
            if(contactIds.size() > 0){
            ZuoraBillingAccountTriggerHandler.zouraUpdate(contactIds);
            }
            if(billingIds.size() > 0){
                ZuoraBillingAccountTriggerHandler.zouraBillingAccountUpdate(billingIds);
        }
  }
 } 
    @future(callout=true)  
    public static void zouraUpdate(Set<String> contactIds){
        List<Zuora.zObject> zuoraZObjectList = new List<Zuora.zObject>();
        for(Zuora__CustomerAccount__c newZCA : [select id,name,Zuora__BillToWorkPhone__c,Zuora__SoldToId__c,Zuora__Zuora_Id__c,Zuora__BillToId__c,Zuora__BillToName__c,
                                                Zuora__BillToAddress1__c,Zuora__BillToAddress2__c,Zuora__BillToCity__c,Zuora__BillToState__c,Zuora__BillToPostalCode__c,Zuora__BillToCountry__c,
                                                Zuora__BillToWorkEmail__c from Zuora__CustomerAccount__c where Zuora__BillToId__c IN :contactIds] ){
          
                    if (!Test.isRunningTest()) {                                       
                    Zuora.zObject acc = new Zuora.zObject('Contact');                                                       
          acc.setValue('Id', newZCA.Zuora__BillToId__c);
                    List<String> nameSplit = newZCA.Zuora__BillToName__c.split(' ');                                        
                    acc.setValue('FirstName', String.isNotBlank(newZCA.Zuora__BillToName__c) ? newZCA.Zuora__BillToName__c : '');
                    acc.setValue('LastName', String.isNotBlank(newZCA.Zuora__BillToName__c) ? newZCA.Zuora__BillToName__c : '');
                    if(nameSplit.size() == 2){
                        acc.setValue('FirstName', nameSplit[0]);
                        acc.setValue('LastName', nameSplit[1]);
                    }
                    acc.setValue('Address1', String.isNotBlank(newZCA.Zuora__BillToAddress1__c) ? newZCA.Zuora__BillToAddress1__c : '');
                    acc.setValue('Address2', String.isNotBlank(newZCA.Zuora__BillToAddress2__c) ? newZCA.Zuora__BillToAddress2__c : '');
                    acc.setValue('City', String.isNotBlank(newZCA.Zuora__BillToCity__c) ? newZCA.Zuora__BillToCity__c : '');
                    acc.setValue('State', String.isNotBlank(newZCA.Zuora__BillToState__c) ? newZCA.Zuora__BillToState__c : '');
                    acc.setValue('PostalCode', String.isNotBlank(newZCA.Zuora__BillToPostalCode__c) ? newZCA.Zuora__BillToPostalCode__c : '');
                    acc.setValue('Country', String.isNotBlank(newZCA.Zuora__BillToCountry__c) ? newZCA.Zuora__BillToCountry__c : '');
                    acc.setValue('WorkEmail', String.isNotBlank(newZCA.Zuora__BillToWorkEmail__c) ? newZCA.Zuora__BillToWorkEmail__c : '');
          acc.setValue('WorkPhone', String.isNotBlank(newZCA.Zuora__BillToWorkPhone__c) ? newZCA.Zuora__BillToWorkPhone__c : '');
          zuoraZObjectList.add(acc);
    }
                                                }
        /*for(Zuora__CustomerAccount__c newZCA : [select id,name,Zuora__BillToWorkPhone__c,Zuora__SoldToId__c,Zuora__Zuora_Id__c,Zuora__BillToId__c,Zuora__BillToName__c,
                                                Zuora__BillToAddress1__c,Zuora__BillToAddress2__c,Zuora__BillToCity__c,Zuora__BillToState__c,Zuora__BillToPostalCode__c,Zuora__BillToCountry__c,     
                                                Zuora__BillToWorkEmail__c from Zuora__CustomerAccount__c where Zuora__BillToId__c IN :contactIds] ){
            Zuora.zObject acc = new Zuora.zObject('Contact');
            acc.setValue('Id', newZCA.Zuora__SoldToId__c);
            List<String> nameSplit = newZCA.Zuora__BillToName__c.split(' ');                                        
            acc.setValue('FirstName', newZCA.Zuora__BillToName__c);
            acc.setValue('LastName', newZCA.Zuora__BillToName__c);
            if(nameSplit.size() == 2){
        acc.setValue('FirstName', nameSplit[0]);
                acc.setValue('LastName', nameSplit[1]);
            }                                                    
            acc.setValue('Address1', newZCA.Zuora__BillToAddress1__c);
            acc.setValue('Address2', newZCA.Zuora__BillToAddress2__c);
            acc.setValue('City', newZCA.Zuora__BillToCity__c);
            acc.setValue('State', newZCA.Zuora__BillToState__c);
            acc.setValue('PostalCode', newZCA.Zuora__BillToPostalCode__c);
            acc.setValue('Country', newZCA.Zuora__BillToCountry__c);
            acc.setValue('WorkEmail', newZCA.Zuora__BillToWorkEmail__c);            
            acc.setValue('WorkPhone', newZCA.Zuora__BillToWorkPhone__c);
            zuoraZObjectList.add(acc);
        }*/
    Zuora.ZApi zApiInstance = new Zuora.ZApi();
      if (!Test.isRunningTest()) {
      Zuora.zApi.LoginResult loginResult = zApiInstance.zlogin();
    }
      if(!zuoraZObjectList.isEmpty()){
  
          List<Zuora.zApi.SaveResult> results = new List<Zuora.zApi.SaveResult>();
  
          if (!Test.isRunningTest()) {
            // callout method documention is here: https://knowledgecenter.zuora.com/CA_Commerce/E_Development_Resources/B_Order_Builder/D_Programming_with_Order_Builder
            results.addAll(zApiInstance.zupdate(zuoraZObjectList));
          }
      for (Zuora.zApi.SaveResult result : results) {
        if (result.Success){
          // nothing for now
        }else{
          //failure, get the errors
          System.debug('CALLOUT FAILED');
          // TODO: add error logic
          /*Zuora.zObject[] errors = result.errors;
                          for (Zuora.zObject error : errors) {
                              String errorCode = (String)error.getValue('Code');
                              String message = (String)error.getValue('Message');
                              System.debug(errorCode + ' ' + message);
                          }*/
        }
      }                  
    
    }
  }
@future(callout=true)  
    public static void zouraBillingAccountUpdate(Set<String> contactIds){
        List<Zuora.zObject> zuoraZObjectList = new List<Zuora.zObject>();
        for(Zuora__CustomerAccount__c newZCA : [select id,name,Zuora__Zuora_Id__c from Zuora__CustomerAccount__c where Zuora__Zuora_Id__c IN :contactIds] ){
    
            if (!Test.isRunningTest()) {
            Zuora.zObject acc = new Zuora.zObject('Account');
            acc.setValue('Id', newZCA.Zuora__Zuora_Id__c);
            acc.setValue('Name',newZCA.Name);
            zuoraZObjectList.add(acc);
            }
        } 
        Zuora.ZApi zApiInstance = new Zuora.ZApi();
        if (!Test.isRunningTest()) {
            Zuora.zApi.LoginResult loginResult = zApiInstance.zlogin();
        }
        if(!zuoraZObjectList.isEmpty()){
        
                List<Zuora.zApi.SaveResult> results = new List<Zuora.zApi.SaveResult>();
        
                if (!Test.isRunningTest()) {
                    // callout method documention is here: https://knowledgecenter.zuora.com/CA_Commerce/E_Development_Resources/B_Order_Builder/D_Programming_with_Order_Builder
                    results.addAll(zApiInstance.zupdate(zuoraZObjectList));
                }
        for (Zuora.zApi.SaveResult result : results) {
            if (result.Success){
                // nothing for now
            }else{
                //failure, get the errors
                System.debug('CALLOUT FAILED');
                // TODO: add error logic
               /*
                Zuora.zObject[] errors = result.errors;
                        for (Zuora.zObject error : errors) {
                            String errorCode = (String)error.getValue('Code');
                            String message = (String)error.getValue('Message');
                            System.debug(errorCode + ' ' + message);
                        }*/               
    
            }
        }                  
        
        }        
    }
  
}

 
I have a requirement to extract 200k records from salesforce and each record has about 60 fields in it. Is it possible with Data loader ?
I have a user who has repeatedly come to me saying several of his contacts on multiple account records have disappeared. I can see them in the company recycle bin and restore them, but so far it is a mystery as to how they are getting deleted in the first place. The recycle bin says that the user has deleted them, but he swears he didn't do it. Does anyone have any idea what could be causing contacts to be deleted? Could it be related to a Salesforce for Outlook sycn? Is it just user error?
 Picklist Client: PHYSICIAN
                       FACILITY
When i click the Facility value autometically display the Provider field value "Yes"


I have Provider field  i want to change 3 values yes and 2 values no, then how to implement the logic in Apex

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.