function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kamaldeep SehrawatKamaldeep Sehrawat 

How to bulkify the apex code

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 its look like my code is not bulkified and its hitting the Governance Limit whenever I am mass updating the Case object. Can somebody please help me to bulkify the code. 

Apex Class

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;
    public static void syncCase(String caseId, String status, String resolution
        , String resolutionMethod, String closedDate, String commentsToSubmitter)
        gguEduIntegration.SFDCHandlerPort port = login();
        port.updateCase(caseId, status, resolution, resolutionMethod, closedDate, commentsToSubmitter);


trigger CaseSyncTrigger on Case (after update) {
    for (Case caseNew : {
        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\'') : ''
        , caseNew.Comments_to_Submitter__c);
        //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\''):''));


Abdul KhatriAbdul Khatri
Here is the answer to you questions

Since you making future callouts within triggers therefore you are quickly reaching governor limit.
Kamaldeep SehrawatKamaldeep Sehrawat

what changes can I made to the code so that it is not hitting the governance limit.??