• ishchopra
  • NEWBIE
  • 35 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 30
    Replies
Hello Everyone,

I am currently working on a scenario where i need to create an alert everytime the attachment on the opportunity is edited.

Can you please explain how this can be achieved without code?

thanks in advance

Ish
Hello Everyone,

this is what i am getting when job runs:

First error: You have uncommitted work pending. Please commit or rollback before calling out​
 
global class EmailReports implements Schedulable 

{
        global void execute(SchedulableContext sc)
        {
               CallSchedule.EmailReports();
              
       }

   }
 
public class CallSchedule {
            
        @future(callout=true)
        public static void EmailReports()
        {

        String ReportID;
        String EvntName;
        
        List<string> reportids = new List<string>{'00OM0000000GzioMAC'};  // reports to send
        List<string> EventName = new List<string>{'EAGC+2016','LNGCAN+2017','CEE+2017','GASASIA+2016','Gastech+2017','GIS+2017'};  // Event Value to be passed runtime 
          
       
       
        if (EventName.size() >0)
        {
        
        for (integer i=0 ; i < 5 ; i++)
        {
        
        ReportID = reportids[0];
        EvntName = EventName[i]; 
          
                           
        ApexPages.PageReference report = new ApexPages.PageReference('/'+ ReportID + '?pv0=' + EvntName +'&csv=1');
              
        Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
        attachment.setFileName('report.csv');
        attachment.setBody(Blob.valueof(report.getContent().toString()));
        //attachment.setBody(Blob.valueof(report1.getContent().toString()));
        attachment.setContentType('text/csv');
        Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
        message.setFileAttachments(new Messaging.EmailFileAttachment[] { attachment } );
        message.setSubject('Report For' + EventName );
        message.setPlainTextBody('The report is attached.');
        message.setToAddresses( new String[] { 'skh@gmail.com' } );
        Messaging.sendEmail( new Messaging.SingleEmailMessage[] { message } );
       
        }
        }   
     }

 
Hello Everyone,

Recently somebody very helpful from the community resolved my problem but still two points missing, can anybody please help?

Scenario

We would like to replace the standard button called Change Status on lead list view to add more fields. This is done but when i click on the new button it doesnt check if we have selected any record on the list view therefore a validation is required, if atleast one record is selected. I placed a java script which works fine with one record but fails when multiple records are selected.

VF page has two dependent picklist which needs to be updated as well, using below code the master picklist changes but dependent doesnt.

Secondly, i want redirection to work, after clicking save, how can i redirect to the same list view?

Here is the Code
 
<apex:page controller="LeadStatusChange" tabStyle="Lead">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>

    <img src="../s.gif" alt="Lead"  class="pageTitleIcon" title="Lead"/><br />
    <h1 class="pageType noSecondHeader">Select New Status</h1>

    <script>
        function handleColumnPicklistChangeEvent(argSelectEle) {
            var jnc = jQuery.noConflict();

            jnc('.StatusChildList').each(function(argEle) {
                this.selectedIndex = argSelectEle.selectedIndex;
            });
        }
    </script>
    <apex:form >
        <apex:pageBlock title="Change Status">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!Save}" value="Save" />
                <apex:commandButton action="{!cancel}" value="Cancel" />
            </apex:pageBlockButtons>
            <apex:variable value="{!1}" var="ind" />
            <apex:pageBlockTable value="{!mLeadRecs}" var="leadRec">
                <apex:column headerValue="#">
                    <apex:outputText value="{!ind}" />
                </apex:column>
                <apex:column >
                    <apex:facet name="header">
                        <apex:outputPanel >
                            <apex:outputLabel value="Status: " for="StatusMainList" />
                            <apex:selectList id="StatusMainList" size="1" multiselect="false" 
                                             onchange="handleColumnPicklistChangeEvent(this);">
                                <apex:selectOptions value="{!StatusPicklist}" />    
                            </apex:selectList>
                        </apex:outputPanel>
                    </apex:facet>
                    <apex:inputField value="{!leadRec.status}" styleClass="StatusChildList" /> 
                </apex:column>
                <apex:column headerValue="Recycled Reason">
                <apex:inputField value="{!leadRec.Recycled_Reason__c}"/>
                    <!-- <apex:inputField value="{!leadRec.Recycled_Reason__c}"/> -->
                </apex:column>
                <apex:column headerValue="Unqualified Reason">
                <apex:inputField value="{!leadRec.Unqualified_Reason__c}"/>
                    <!-- <apex:inputField value="{!leadRec.Unqualified_Reason__c}"/> -->
                </apex:column>
                <apex:variable value="{!ind + 1}" var="ind" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
public with sharing class LeadStatusChange {
    public List<Lead> mLeadRecs {get;set;}

    public LeadStatusChange () {
        String lStrLeadID = ApexPages.currentPage().getParameters().get('ids');
        
        
        mLeadRecs = [SELECT id, name,status, Recycled_Reason__c, Unqualified_Reason__c FROM Lead WHERE id IN:lStrLeadID.split(',')];
    
    }

    public PageReference save() {
        update mLeadRecs;
        return new PageReference('/00Q/o');
    }

    public PageReference cancel() {
        return new PageReference('/00Q/o');
    }

public List<SelectOption> getStatusPicklist() {

        List<SelectOption> lOptions = new List<SelectOption>();

         

        for(Schema.PicklistEntry lFieldMeta : Lead.Status.getDescribe().getPicklistValues()) {
            lOptions.add(new SelectOption(lFieldMeta.getValue(), lFieldMeta.getLabel()));

        }

 

        return lOptions;

    }

}
thanks





 
I am facing a small problem with custom button and VF Page.

Scenario

We would like to replace the standard button called Change Status on lead list view to add more fields. This is done but when i click on the new button it doesnt check if we have selected any record on the list view therefore a validation is required, if atleast one record is selected. I placed a java script which works fine with one record but fails when multiple records are selected.

here is the java code
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var ids = {!GETRECORDIDS($ObjectType.Lead)};

if(ids.length > 0) {
    window.location='../apex/Lead_Status_Change?ids='+ids;
} else {
    alert("No Row Selected");
}



java.lang.IllegalArgumentException: id 00Q550000022tMl,00Q550000022tS9 must be 15 characters

Can somebody please help?

A
Hello Experts,

I am writing a trigger to meet one of the objectives but couldn't get it working. This is a cross object updation. 

Scenario:

On an opportunity we have a related list called Asperato_Trasaction which is a credit card payment tool, when opportunities is closed won then payment can be collected within salesforce using this add on. What we wanted to do is copy the amount and payment status from this related list to opportunity. 

Opportunity Fields
Asperato Payment Status
Total Amount Paid

Asperato Fields
AP_Status__c
AP_Amount__c

the relation ship is not master detail between both objects.

Here is the code i have tried with my limited knowledge of Apex, currently i have tried to copy only one field i.e. payment status but ultimately i wanted to bring over both fields. Also, we want to fire the trigger when Asperato_Transaction (related list) occurs.

here is the code, this code doesnt give any erros but doesnt work either.. any help is much appreciated.
 
trigger UpdateAmount on Asperato_Transaction__c (after insert,after update)
{

 
set<id> ASSID = new set<id>();


    for(Asperato_Transaction__c ass : Trigger.new){
        if(ass.AP_Status__c == 'Paid'){
            ASSID.add(ass.AP_Opportunity__c);
        }
            
}
//create list of opportunities to iterate on
List<Opportunity> OppUpdateList = [SELECT Id, Asperato_Transaction_Status__c FROM Opportunity WHERE id in: ASSID];
    Map<id,opportunity> opMap = new map<id,opportunity>();

    for(opportunity o : OppUpdateList)
    
            {
                opMap.put(o.id,o);
            }
    for(Asperato_Transaction__c ACID : Trigger.new)
            {
                if(acid.AP_Status__c == 'Paid')
                    {
                        Opportunity thisop = opMap.get(ACID.AP_opportunity__c);
                        thisop.Asperato_Transaction_Status__c = ACID.AP_Status__c;
                    }
                    
               }                                    
            
            
}

 
Hello Experts,

Good Morning!

I have a scenario which is taking lot of time to resolve one problem.

What i am trying to Achieve?

When doing mass approval on opportunities we get this error message - THERE WERE CUSTOM VALIDATION ERROR(S) ENCOUNTERED WHILE SAVING THE AFFECTED RECORD. THE FIRST VALIDATION ERROR ENCOUNTERED WAS "APEX TRIGGER AFTERTRIGGER_OPPORTUNITY CAUSED AN UNEXPECTED EXCEPTION, VALIDATION ERROR WHILE SAVING RECORD(S)
SYSTEM.LISTeXCEPTION: DUPLICATE ID IN LIST : 


Apex Class
 
public class DiscountedProductsApproved {
    public static void SetProductsApproved(Opportunity[] theNewTrigger,Opportunity[] theOldTrigger){
        
        //Recast the inbound data to its original SObject type
        List<Opportunity> theNewOpportunity = (List<Opportunity>) theNewTrigger;
        List<Opportunity> theOldOpportunity = (List<Opportunity>) theOldTrigger;
        
        //Find the Approved Opps with Line Items that need Approving
        List<Opportunity> theNewOpportunitywithLineItems = [select id, name, (select id,Discount_Approved__c,Discount_Amount__c from OpportunityLineItems WHERE Discount_Approved__c = False AND Discount_Amount__c >0)from Opportunity where Id IN :theNewOpportunity];
        
        //List to hold the Line Items to be updated
        list<OpportunityLineItem> oLineItemsToUpdate = new list<OpportunityLineItem>{};
        Integer j=0;    
        //Loop through the Opps from the Trigger        
        for (Integer i = 0; i < theNewOpportunity.size(); i++) {
        
        //Only process the Opps that have had the Discount_Approval_Status__c field updated
            If(theNewOpportunity[i].Discount_Approval_Status__c == 'Approved'
               && theOldOpportunity[i].Discount_Approval_Status__c != 'Approved'){
        
        //Loop through the Opps and Line Items that need Approving            
                   for(Opportunity o: theNewOpportunitywithLineItems){
                       for(OpportunityLineItem oli: o.OpportunityLineItems){
                           oli.Discount_Approved__c = True;
                           oLineItemsToUpdate.add(oli);
                           j++;
                       }
                   }
               }
        }
        //Debug values
        system.debug('The number of Opportunity Line Items processed (j): ' + j);
        system.debug('The number of Opps processed (size): ' + theNewOpportunity.size());
        system.debug('The number of Opps with line items processed (size): ' + theNewOpportunitywithLineItems.size());
        
        update oLineItemsToUpdate;
    }

}

Apex Trigger AfterTrigger_Opportunity
 
trigger AfterTrigger_Opportunity on Opportunity (after update, after insert, after delete) {
    
     if(Trigger.isAfter){
        if(Trigger.isUpdate){
            //Send the Opportunity data to the Apex class for Rollup
            EventStakeholderRollup.rollupStakeholder(Trigger.new);
            //Send Opportunity data to the Apex class for Approval Submission
            SubmitOppForApproval.SubmitForApproval(Trigger.new,Trigger.old);
            //Send Opportunity data to the Apex class to update Approved Line Items
            for(Opportunity opp: Trigger.new){
                if(opp.No_Products_Requiring_Discount_Approval__c>0){
                    DiscountedProductsApproved.SetProductsApproved(Trigger.new,Trigger.old);
                }
            }
        } 
        if(Trigger.isInsert){
            //Send the Opportunity data to the Apex class
            EventStakeholderRollup.rollupStakeholder(Trigger.new);
        } 
        if(Trigger.isDelete){
            //Send the Opportunity data to the Apex class
            EventStakeholderRollup.rollupStakeholder(Trigger.old);
        } 
     }
}

My Investigation

The error is related to opportunity line item as it says in the error message, somehow the opportunity line item is being repeated in the list however, this only happens when product name is same on the opportunity for example: If i am taking two opportunities for mass approval and both opportunity has same products under opportunity line item then it will give the above error message but if opportunity has different products then process go through without any problems.

Can somebody help pease? we have 150 approvals daily and list is getting bigger.

thanks
Hello Experts,

We have a problem related to a process which we are trying to map to salesforce, scrapping spread-sheets.

Scenario

We are an event organisers and run events all over world (various segments), people opt to come in to the event, some people show interests and sometimes multiple people come to attend event from same company. Currently a team of people enter the name of the attendee's manually in salesforce as contacts and then attached to an opportunity.

Problem

We have adopted a method of web-to-lead to capture information directly to Salesforce and that is working well (though we want web-to-contact) but as of now we can live with web-to-lead. The real challenge is how we can capture multiple leads/contact through a web page into Salesforce.

For Example:

if 4 people coming to an event from same company and trying to register through web-site then how we can prompt them to fill four forms so that we capture four different leads/contacts rather than just one record?


if anyone can give us any sort of guidence then we can overcome this problem.

any response is highly appreciated

Regards,

Ankur
Hello Everyone,

I have a question about Code Coverage, I am trying to deploy some changes i have made in one of thr Trigger and Class but i am getting this error.

Details: Average test coverage across all Apex Classes and Triggers is 72%, at least 75% test coverage is required.

My Sandbox has code coverage of 79% but when it comes to deploy - it says 72% as above (am i doing something wrong)

please help.

Regards,

Hello Everyone,

 

Below is my controller and VF page but for some reason it is not showing me the related contacts. Can you please advice?

 

 

 

Apex Class:

 

public with sharing class Second
{
public Account AC{ get; set; }  
public List<Contact> CI{ get; set; }

public second()
{
AC= new account();
CI = new list<Contact>();
}
public pagereference FindContacts()

{

    CI = [SELECT FirstName, LastName FROM Contact WHERE AccountId = :AC.parentid];

return null;
            
}
}

 

==================================================================================

 

VF:

 

 

<apex:page controller="Second">
<apex:form >

            <apex:pageBlock Title="Select Account">
                 <apex:inputField value="{!AC.parentid}"/>

<apex:commandButton action="{!FindContacts}" value="FindContacts" reRender="contacts"/>
                 
               </apex:pageblock>

<apex:pageblock id="Contacts" Title="Contacts" >
<apex:pageBlockTable value="{!CI}" var="AB" >

                         <apex:column value="{!AB.firstName}"/>
                        <apex:column value="{!AB.lastname}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

I am new to the VF and if somebody can explain the "Contacts" above in bold used in reRender and <apex:pageblock id="Contacts" Title="Contacts" > then it will really help me to focus on right direction.

 

waiting for the replies

 

thankyou so much for looking

 

ish

Hello Everyone,

I am currently working on a scenario where i need to create an alert everytime the attachment on the opportunity is edited.

Can you please explain how this can be achieved without code?

thanks in advance

Ish
Hello Everyone,

this is what i am getting when job runs:

First error: You have uncommitted work pending. Please commit or rollback before calling out​
 
global class EmailReports implements Schedulable 

{
        global void execute(SchedulableContext sc)
        {
               CallSchedule.EmailReports();
              
       }

   }
 
public class CallSchedule {
            
        @future(callout=true)
        public static void EmailReports()
        {

        String ReportID;
        String EvntName;
        
        List<string> reportids = new List<string>{'00OM0000000GzioMAC'};  // reports to send
        List<string> EventName = new List<string>{'EAGC+2016','LNGCAN+2017','CEE+2017','GASASIA+2016','Gastech+2017','GIS+2017'};  // Event Value to be passed runtime 
          
       
       
        if (EventName.size() >0)
        {
        
        for (integer i=0 ; i < 5 ; i++)
        {
        
        ReportID = reportids[0];
        EvntName = EventName[i]; 
          
                           
        ApexPages.PageReference report = new ApexPages.PageReference('/'+ ReportID + '?pv0=' + EvntName +'&csv=1');
              
        Messaging.EmailFileAttachment attachment = new Messaging.EmailFileAttachment();
        attachment.setFileName('report.csv');
        attachment.setBody(Blob.valueof(report.getContent().toString()));
        //attachment.setBody(Blob.valueof(report1.getContent().toString()));
        attachment.setContentType('text/csv');
        Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
        message.setFileAttachments(new Messaging.EmailFileAttachment[] { attachment } );
        message.setSubject('Report For' + EventName );
        message.setPlainTextBody('The report is attached.');
        message.setToAddresses( new String[] { 'skh@gmail.com' } );
        Messaging.sendEmail( new Messaging.SingleEmailMessage[] { message } );
       
        }
        }   
     }

 
I am facing a small problem with custom button and VF Page.

Scenario

We would like to replace the standard button called Change Status on lead list view to add more fields. This is done but when i click on the new button it doesnt check if we have selected any record on the list view therefore a validation is required, if atleast one record is selected. I placed a java script which works fine with one record but fails when multiple records are selected.

here is the java code
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}
var ids = {!GETRECORDIDS($ObjectType.Lead)};

if(ids.length > 0) {
    window.location='../apex/Lead_Status_Change?ids='+ids;
} else {
    alert("No Row Selected");
}



java.lang.IllegalArgumentException: id 00Q550000022tMl,00Q550000022tS9 must be 15 characters

Can somebody please help?

A
Hello All,
I am doing an api callout to an 3rd party website and i am writing an schedule class for that. while executing that scheduled calss i am getting the above error saying that you have some uncommitted work pending,please commit before rolling out. I have googled a lot about this and seems like we cannot callout after performing an Dml operations,

But in my code i am not able to seperate Dml and callout. Even i added @future annotation before the method which i used for Callout. It is retrieving the details of the first record after that when going to the second callout it is giving that error.

Basically it is following the unstructured format like doing a callout first and doing DML after that and again going for the callout- Which seems like not a best practice. So any suggestions in code will be a huge help.
@future(callout=true)
    public static void processAllOpenRequisition(){
        bulkify  = true;
       u = [SELECT Username_Broadbean__c,Password_Broadbean__c From USER WHERE id =:UserInfo.getUserId()];
        HttpRequest req = new HttpRequest();
        req.setMethod('POST');
        req.setEndpoint('https://api.adcourier.com/hybrid/hybrid.cgi');
        req.setHeader('Content-Type', 'text/xml');
        requisitionRecMap = new Map<id, Recruiting_Activities__c>([SELECT  Time_now__c,Time_From__c FROM Recruiting_Activities__c WHERE EL_Status__c <> 'Closed' AND REcordtype.Name=:'Requisition' ]);
        system.debug('hellooooo'+requisitionRecMap);
          readObject(requisitionRecMap.keySet()); --> Here calling the another method for XML
           req.setBody(xmlData); 
            Http http = new Http();
            req.setTimeout(60000);
             if(!test.isrunningtest()){
                HttpResponse res = http.send(req);
                resbody = res.getBody();
                System.debug('*****'+res.getBody()); // Here you will get the response
             } 
       
            parseTest(); --> It is the method for parsing the data, here we are doing DML operations.
    }
    
    
 public static void readObject(Set<Id> recids){ 
   for(Recruiting_Activities__c ra:[SELECT  Time_now__c,Time_From__c,Req_ID__c  FROM Recruiting_Activities__c where Id IN:recids]){
       JobReference=ra.Req_ID__c;
       xmlData+='<?xml version="1.0" encoding="utf-8" ?>'
                +'<AdCourierAPI>'
                +'<Method>RetrieveApplications</Method>'
                +'<APIKey>3012861772</APIKey>'
                +'<Account>'
                    +'<UserName>'+u.Username_Broadbean__c+'</UserName>'
                    +'<Password>'+u.Password_Broadbean__c+'</Password>'
                +'</Account>'
                +'<Options>'
                    +'<Filter>'
                        +'<JobReference>'+JobReference+'</JobReference>'
                        +'<Times>'
                            +'<TimeFrom>ra.Time_From__c</TimeFrom>'
                            +'<TimeTo>2020-12-24T06:15:00Z</TimeTo>'
                        +'</Times>'
                        +'<Id></Id>'
                        +'<Rank>All</Rank>'
                    +'</Filter>'
                    +'<BodyFormat EncodingType="None" />'
                    +'<EmbedDocuments EncodingType="Base64">true</EmbedDocuments>'
                   +'<XMLFormat EncodingType="Base64">BGT</XMLFormat>'
                    +'<IncludeAddress>false</IncludeAddress>'
                +'</Options>'
            +'</AdCourierAPI>';
       system.debug('--------'+xmlData);
   }     
    
 }

 
Hi,

I am stuck with an problem with my schedular. I am tyring to read files from S3 bucket using amazon S3 api calls. When I am trying to call this method using schedular it gives me error :
  System.CalloutException: Callout from scheduled Apex not supported.

Here is my schedula class :

global class ScheduleXMLDownload implements Schedulable{
  
   global void execute(SchedulableContext SC) {
        downloadFiles();
    }
  
      public static void downloadFiles(){
       try{
          ReadXml.requestIvans();
         }
   catch (DmlException ex)  { 
          system.debug('error insert DefaultProducer '); 
  
         
        }
    }
   
}


Here is my method I am calling in shedular.


-------------------------------------------------------------------------------

@future(callout=true)
     public static void requestIvans(){
        Http h = new Http();
        AmazonAccess amz = new AmazonAccess();
        
        CanaryAMS__Defaults__c property = CanaryAMS__Defaults__c.getValues('MailBoxId');
        String mailBoxId = property.CanaryAMS__value__c;
       
        Map< String,String> xmlFileList = new map<String,String>();
        
        String aWSAccessKeyId = amz.key;
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        SaveObjects.ListEntry[] bucketList  = amz.listBucket('canary.ams.xml',mailBoxId);
       
        List<String> xmlResponseList = new List<String>();
        List<String> bucketKeys = new List<String>();
        String filesToDelete = ''; 
        boolean runSchedular = true;
        Integer countRun = 0 ;
        do {
  
       if(bucketList!=null && !bucketList.isEmpty()){
        runSchedular = false;
        Integer maxFiles  = bucketList.size();
        if(maxFiles>3){
        maxFiles = 3;
        }
           for(integer i=1; i<maxFiles; i++){
               Datetime now = DateTime.now();
               Datetime expireson = now.AddSeconds(30+i);
               Long Lexpires = expireson.getTime()/1000;
               Lexpires = Lexpires + i;
               bucketToList = 'canary.ams.xml';
               String stringtosign = 'GET\n\n\n'+Lexpires+'\n/'+bucketToList+'/'+bucketList[i].Key;
          
               String signed = amz.make_sig(stringtosign);
              
               String url = 'http://'+bucketToList+'.s3.amazonaws.com/'+bucketList[i].Key+'?AWSAccessKeyId='+aWSAccessKeyId+'&Expires='+Lexpires+'&Signature='+signed;
        //     system.debug('shalini ======= > '+url);
          //     String url =  'https://s3-us-west-2.amazonaws.com/canary.ams.xml/'+bucketList[i].Key;
               bucketKeys.add(bucketList[i].Key);
               system.debug(url);
               //String url = EncodingUtil.URLENCODE(url1,'UTF-8');
               req.setEndPoint(url);
               req.setMethod('GET');
               res = h.send(req);
             
               String response = res.getBody();
               ReadXml readXml = new ReadXml();
               if(readXml.checkXMlFormat(response)){
                //filesToDelete = filesToDelete+bucketList[i].Key+',';
                xmlResponseList.add(response);
                xmlFileList.put(bucketList[i].Key,response);
               }
            
          }
          ReadXml readXml = new ReadXml();
          readXml.processXMl(xmlFileList);
          
         /* String url =  'http://ec2-54-186-194-3.us-west-2.compute.amazonaws.com/Script/UploadToS3Bucket/moveToArchiveFolder.php?key=';
          url = url+filesToDelete;
          req.setEndPoint(url);
          req.setMethod('GET');
          res = h.send(req);
         
         
          String response = res.getBody();
          for(String resp : xmlResponseList){
              if(checkXMlFormat(resp)){
                parse(resp);
              }
          } */
         
         
      }else{
      system.debug(' ==================== schedular Error ====================');
           if(countRun < 3 )  
           {   
    countRun ++ ;
    runSchedular = true;
    system.debug('S3 bucket is not accessible '+Apexpages.Severity.ERROR ) ;
           }
           else
           {
     runSchedular = false;
           }
      }
      } while (runSchedular);
       
       
    }


   
   I have searched on google and most of solutions are to add @future annotaion over my method. I have tried this, but it is still not working.
   Please let me know whats wrong with my code?

Thanks