• Sunidhar
  • NEWBIE
  • 78 Points
  • Member since 2013


  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 22
    Replies
Hi All, 

I am in process of developing a code to get the information from the Case Object and update it on our Website. I have developed all the code (Apex Classes and Apex Trigger) and the code is working well but I am getting an Error while I am doing a mass update of more than 51 records on the Case Object due to the classes and triggers. Can any body Help me in bulkfying the code or even suggest me ways I can improve the code so that I doesn't get any errors while mass updating the records in Case Object. 

Below are the Apex Classes and Trigger that I have developed 

Apex Class 1

public class GGUSettings
{
    public static string USERNAME = 'abc';
    public static string PASSWORD = 'abc';
    public static string GGU_END_POINT = 'https://www.ggu.edu';
}

Apex Class 2 

//Generated by wsdl2apex

public class gguEduIntegration {
    public class Exception_x {
        public String message;
        private String[] message_type_info = new String[]{'message','http://ggu.edu/integration',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://ggu.edu/integration','false','false'};
        private String[] field_order_type_info = new String[]{'message'};
    }
    public class result {
        public String[] error;
        public String status;
        private String[] error_type_info = new String[]{'error','http://ggu.edu/integration',null,'0','-1','true'};
        private String[] status_type_info = new String[]{'status','http://ggu.edu/integration',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://ggu.edu/integration','false','false'};
        private String[] field_order_type_info = new String[]{'error','status'};
    }
    public class updateCase {
        public String caseId;
        public String status;
        public String resolution;
        public String resolutionMethod;
        public String closeDate;
        private String[] caseId_type_info = new String[]{'caseId','http://ggu.edu/integration',null,'0','1','false'};
        private String[] status_type_info = new String[]{'status','http://ggu.edu/integration',null,'0','1','false'};
        private String[] resolution_type_info = new String[]{'resolution','http://ggu.edu/integration',null,'0','1','false'};
        private String[] resolutionMethod_type_info = new String[]{'resolutionMethod','http://ggu.edu/integration',null,'0','1','false'};
        private String[] closeDate_type_info = new String[]{'closeDate','http://ggu.edu/integration',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://ggu.edu/integration','false','false'};
        private String[] field_order_type_info = new String[]{'caseId','status','resolution','resolutionMethod','closeDate'};
    }
    public class updateCaseResponse {
        public gguEduIntegration.result return_x;
        private String[] return_x_type_info = new String[]{'return','http://ggu.edu/integration',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://ggu.edu/integration','false','false'};
        private String[] field_order_type_info = new String[]{'return_x'};
    }
    public class SFDCHandlerPort {
        public String endpoint_x = 'https://www.ggu.edu/integration';
        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://ggu.edu/integration', 'gguEduIntegration'};
        public gguEduIntegration.result updateCase(String caseId,String status,String resolution,String resolutionMethod,String closeDate) {
            gguEduIntegration.updateCase request_x = new gguEduIntegration.updateCase();
            request_x.caseId = caseId;
            request_x.status = status;
            request_x.resolution = resolution;
            request_x.resolutionMethod = resolutionMethod;
            request_x.closeDate = closeDate;
            gguEduIntegration.updateCaseResponse response_x;
            Map<String, gguEduIntegration.updateCaseResponse> response_map_x = new Map<String, gguEduIntegration.updateCaseResponse>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://ggu.edu/integration',
              'updateCase',
              'http://ggu.edu/integration',
              'updateCaseResponse',
              'gguEduIntegration.updateCaseResponse'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.return_x;
        }
    }
}


Apex Class 3 

public class GGUWSCall
{
    private static gguEduIntegration.SFDCHandlerPort login(){
        gguEduIntegration.SFDCHandlerPort port = new gguEduIntegration.SFDCHandlerPort();
         
        port.inputHttpHeaders_x = new Map<String, String>();

        Blob headerValue = Blob.valueOf(GGUSettings.USERNAME + ':' + GGUSettings.PASSWORD );
         
        String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);

        port.inputHttpHeaders_x.put('Authorization', authorizationHeader);

        port.inputHttpHeaders_x.put('Content-Type', 'text/xml; charset=utf-8');
       
        return port;
    }
    
    @Future(callout=true) 
    public static void syncCase(String caseId, String status, String resolution, String resolutionMethod, String closedDate)
    {                 
        gguEduIntegration.SFDCHandlerPort port = login();
        port.updateCase(caseId, status, resolution, resolutionMethod, closedDate);
    }
}

Apex Trigger 

Trigger 

trigger CaseSyncTrigger on Case (after update) {
    for (Case caseNew : Trigger.new) {
        GGUWSCall.syncCase(caseNew.CaseID__c, caseNew.Status, caseNew.Resolution__c, caseNew.ResolutionMethod__c, caseNew.ClosedDate != null ? caseNew.ClosedDate.format('yyyy-MM-dd\'T\'hh:mm:ss\'Z\'') : '');
//        System.debug(Logginglevel.INFO, 'caseId: '+caseNew.CaseID__c+' status: '+caseNew.Status + ' resolution: '+caseNew.Resolution__c+ ' resolutionMethod: '+ 
//        caseNew.ResolutionMethod__c + ' closeDate: '+(caseNew.ClosedDate!=null?caseNew.ClosedDate.format('yyyy-MM-dd\'T\'hh:mm:ss\'Z\''):''));
    }
}

Thanks 





 
Hi All,

I am showing Account List on visualforce page using pageblocktable tag. I want to Add checkbox in front of every record. For this i did use <apex:inputcheckbox> tag but checkbox is not showing on page.

Please help me...
I have an Apex Trigger that counts the number of Projects that have been created on an Account, and i realized today that if you create the first Project on an Account the field displays 1, but then if you delete that Project the field still displays 1. I need it to go back to zero if there are no Projects on the Account anymore.

Any help would be greatly appreciated,
I have a requirement to design VF pages so that each field in custom object is on a different page.
I have used PageReference in apex class that saves the data and navigates to next object.

Problem i am facing, is the save is creating new instance of the object instead of updating.
Please provide a way to update the same instance of the object before navigating to next page.
 
I download the current version of the jQuery Mobile JavaScript library, Zip File: jquery.mobile-1.4.5.zip
The size of this zipped file is 7.54 MB. 
Unable to add this as  a static resource because size exceeds the 5MB limit. 
Any suggestions as to what others do ? Thanks!
I have an Apex Trigger losted below. It counts the number of tasks on an account, and it works perfectly, but i want it to only count Attempted and Completed Call, I currently have it counting only Attempted Calls because everytime i try and add Completed Call it doesnt work at all. Any Ideas?

trigger SumCallActivitesOnAccount on Task (after insert, after update, after delete) {

    set<Id> set_Id = new set<Id>();
   
    List<Account>acc_list = new List<Account>();
    
    if(Trigger.isInsert || Trigger.isUpdate) {
        for(Task T:Trigger.new){
            set_Id.add(T.WhatId);
        }

     }
    else if(Trigger.isDelete){
        for(Task T:Trigger.old){
            set_Id.add(T.WhatId);
        }

     }
     
    if(Trigger.isAfter && (Trigger.isUpdate || Trigger.isInsert || Trigger.isDelete)){
        acc_list=[SELECT Id, Sum_Call_Activities__c, (SELECT Id FROM Tasks WHERE Subject = 'Attempted Call') FROM Account WHERE Id IN :set_Id];

     for(Account acc: acc_list){
        if(acc.Tasks.size()>0)
            acc.Sum_Call_Activities__c = acc.Tasks.size();
        else
            acc.Sum_Call_Activities__c = 0;
     }
        if(!acc_list.isEmpty())
            update acc_list;
        }

}
My code is
 
For(Opportunity opp : trigger.new)
     { 
       If(!SetEmaiIDs.contains(opp.Email__c)) // checking if added email is already not present on some other account
       {
         opp.Account.Account_Email__c  = opp.Email__c; // This line is throwing error

       }

For email field, I am getting Attempt to de-reference a null object: error on same line

How do I solve this?

 
Hi All, 

I am in process of developing a code to get the information from the Case Object and update it on our Website. I have developed all the code (Apex Classes and Apex Trigger) and the code is working well but I am getting an Error while I am doing a mass update of more than 51 records on the Case Object due to the classes and triggers. Can any body Help me in bulkfying the code or even suggest me ways I can improve the code so that I doesn't get any errors while mass updating the records in Case Object. 

Below are the Apex Classes and Trigger that I have developed 

Apex Class 1

public class GGUSettings
{
    public static string USERNAME = 'abc';
    public static string PASSWORD = 'abc';
    public static string GGU_END_POINT = 'https://www.ggu.edu';
}

Apex Class 2 

//Generated by wsdl2apex

public class gguEduIntegration {
    public class Exception_x {
        public String message;
        private String[] message_type_info = new String[]{'message','http://ggu.edu/integration',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://ggu.edu/integration','false','false'};
        private String[] field_order_type_info = new String[]{'message'};
    }
    public class result {
        public String[] error;
        public String status;
        private String[] error_type_info = new String[]{'error','http://ggu.edu/integration',null,'0','-1','true'};
        private String[] status_type_info = new String[]{'status','http://ggu.edu/integration',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://ggu.edu/integration','false','false'};
        private String[] field_order_type_info = new String[]{'error','status'};
    }
    public class updateCase {
        public String caseId;
        public String status;
        public String resolution;
        public String resolutionMethod;
        public String closeDate;
        private String[] caseId_type_info = new String[]{'caseId','http://ggu.edu/integration',null,'0','1','false'};
        private String[] status_type_info = new String[]{'status','http://ggu.edu/integration',null,'0','1','false'};
        private String[] resolution_type_info = new String[]{'resolution','http://ggu.edu/integration',null,'0','1','false'};
        private String[] resolutionMethod_type_info = new String[]{'resolutionMethod','http://ggu.edu/integration',null,'0','1','false'};
        private String[] closeDate_type_info = new String[]{'closeDate','http://ggu.edu/integration',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://ggu.edu/integration','false','false'};
        private String[] field_order_type_info = new String[]{'caseId','status','resolution','resolutionMethod','closeDate'};
    }
    public class updateCaseResponse {
        public gguEduIntegration.result return_x;
        private String[] return_x_type_info = new String[]{'return','http://ggu.edu/integration',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://ggu.edu/integration','false','false'};
        private String[] field_order_type_info = new String[]{'return_x'};
    }
    public class SFDCHandlerPort {
        public String endpoint_x = 'https://www.ggu.edu/integration';
        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://ggu.edu/integration', 'gguEduIntegration'};
        public gguEduIntegration.result updateCase(String caseId,String status,String resolution,String resolutionMethod,String closeDate) {
            gguEduIntegration.updateCase request_x = new gguEduIntegration.updateCase();
            request_x.caseId = caseId;
            request_x.status = status;
            request_x.resolution = resolution;
            request_x.resolutionMethod = resolutionMethod;
            request_x.closeDate = closeDate;
            gguEduIntegration.updateCaseResponse response_x;
            Map<String, gguEduIntegration.updateCaseResponse> response_map_x = new Map<String, gguEduIntegration.updateCaseResponse>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://ggu.edu/integration',
              'updateCase',
              'http://ggu.edu/integration',
              'updateCaseResponse',
              'gguEduIntegration.updateCaseResponse'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.return_x;
        }
    }
}


Apex Class 3 

public class GGUWSCall
{
    private static gguEduIntegration.SFDCHandlerPort login(){
        gguEduIntegration.SFDCHandlerPort port = new gguEduIntegration.SFDCHandlerPort();
         
        port.inputHttpHeaders_x = new Map<String, String>();

        Blob headerValue = Blob.valueOf(GGUSettings.USERNAME + ':' + GGUSettings.PASSWORD );
         
        String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);

        port.inputHttpHeaders_x.put('Authorization', authorizationHeader);

        port.inputHttpHeaders_x.put('Content-Type', 'text/xml; charset=utf-8');
       
        return port;
    }
    
    @Future(callout=true) 
    public static void syncCase(String caseId, String status, String resolution, String resolutionMethod, String closedDate)
    {                 
        gguEduIntegration.SFDCHandlerPort port = login();
        port.updateCase(caseId, status, resolution, resolutionMethod, closedDate);
    }
}

Apex Trigger 

Trigger 

trigger CaseSyncTrigger on Case (after update) {
    for (Case caseNew : Trigger.new) {
        GGUWSCall.syncCase(caseNew.CaseID__c, caseNew.Status, caseNew.Resolution__c, caseNew.ResolutionMethod__c, caseNew.ClosedDate != null ? caseNew.ClosedDate.format('yyyy-MM-dd\'T\'hh:mm:ss\'Z\'') : '');
//        System.debug(Logginglevel.INFO, 'caseId: '+caseNew.CaseID__c+' status: '+caseNew.Status + ' resolution: '+caseNew.Resolution__c+ ' resolutionMethod: '+ 
//        caseNew.ResolutionMethod__c + ' closeDate: '+(caseNew.ClosedDate!=null?caseNew.ClosedDate.format('yyyy-MM-dd\'T\'hh:mm:ss\'Z\''):''));
    }
}

Thanks 





 
Hi All,

I am showing Account List on visualforce page using pageblocktable tag. I want to Add checkbox in front of every record. For this i did use <apex:inputcheckbox> tag but checkbox is not showing on page.

Please help me...
Hi,

I need to have a trigger on Account Object. My requirement is - 

1. There is two recordtypes on account object acc1, acc2.
2.  When i will create a record by select acc1, a custom field (account number ) should be updated with acc10001.
3. Similarly When i will create a record by select acc2,  custom field (account number ) should be updated with acc20001 not by acc2002.

Kindly help.

Regards
 
Hi,

I have input search field in vf page, as per the search given in that field i am displaying resulted data in a table (Item and price).

now, i have to show sum of price column values in a table(Soql query resulted data as per value given in a input search filed).

Kindly help to achieve this scenario.

Item         Price 
  A            100
  B            300
  C            500
      Total:  900

Thanks in Advance!!
  • January 31, 2015
  • Like
  • 0
Hello,
If I write the follwing SOQL querry in QUERRY EDITOR I am getting exact results(ID of Contact, Name of Contact and Name of Parent Account)
 
Note: We already know that Account is Parent of Contact
SELECT Id, Name, Account.name FROM Contact

If I execute same querry in Execute Anonymous window instead of  Name of Parent Account I am getting Parent Account Id.

Why I am getting like that will any one of you explain me and what should I do to get Name of Parent Account.
Thank you in advance.

  id myProductId; 
  Public Document_Reference_Junction__c DocuRefIP { Get; Set; }
Hi

while running test classs , test method has failed it shows List has no rows for assignment to SObject. any one help me how to avoid this error. and this is my class.

public class sample{
public sample(){
  DocuRefIP = New Document_Reference_Junction__c();
  myProductId=ApexPages.CurrentPage().getParameters().get('Id');
  DocuRefIP.Installed_Product__c=[select id from SVMXC__Installed_Product__c where id=:myProductId limit 1].id;
  }  
}
I have an Apex Trigger that counts the number of Projects that have been created on an Account, and i realized today that if you create the first Project on an Account the field displays 1, but then if you delete that Project the field still displays 1. I need it to go back to zero if there are no Projects on the Account anymore.

Any help would be greatly appreciated,