• Kris Kris
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hello,

I just started learning. Sorry if my question is very basic but I was not able to find the answer to it.
I am trying to create a button that when clicked, a modal pops up with two buttons that each will create a separate message on the first page.
So far I created a new lightening component and I was able to create the button, but the thing is that I don't know how I can debug/run it so that I can see the button.
I went through multiple videos but I cuoldn't figure it out. I appreciate if someone can give me a clue.

Thanks! 
 
Hello!

Any time I attempt to schedule the following Apex Class on any frequency via either UI or Dev Console, it'll run once and then be removed from the Scheduled Jobs. 

global class CompositeProjectImportScheduler implements Schedulable
{
  global void execute(SchedulableContext sc) 
  {
      Set<Id> setApexClassId = new Set<Id>();
        for(ApexClass apexClassDetails : [Select Id, Name from ApexClass 
          where Name = 'BatchCompositeProjectProcessor'])
        {
          setApexClassId.add(apexClassDetails.id);
        }
        
        List<AsyncApexJob> lstJobs = [Select Id, Status, ApexClassID
        from AsyncApexJob where 
        (Status = 'Queued' OR Status = 'Processing' OR
         Status = 'Preparing') and ApexClassID IN: setApexClassId];

      // Make sure there are no current batch jobs running
        //
        if(lstJobs == null || lstJobs.size() == 0)
      {
            // Start the EO CP import processor batch job which will process any records 
            // that are 'readyforprocessing'.
            //
        eo2.BatchCompositeProjectProcessor BCP = new eo2.BatchCompositeProjectProcessor();
          Database.executeBatch(BCP,1);
      }
      else
      {
        system.debug('CP import batch job already in progress, please wait for the current batch job to complete.');
      }
        
        // Clean up the current scheduled job so that another can be started again later.
        //
        system.abortJob(sc.getTriggerID());
  }
    
    // Call this from your trigger to create a scheduled job which will start the CP import 
    // processor batch job
    //
    public static void scheduleProcessing()
    {
        ApexClass apexClassDetails = [Select Id, Name from ApexClass
            where Name = 'CompositeProjectImportScheduler'];

        List<AsyncApexJob> lstJobs = [Select Id, Status, ApexClassID
            from AsyncApexJob where
            (Status = 'Queued' OR Status = 'Processing' OR
             Status = 'Preparing' OR Status = '') and ApexClassID =: apexClassDetails.Id];

        // Make sure there isn't already a scheduled job.  Salesforce will only allow one 
        // scheduled job for a given class so this ensures that only one batch job is 
        // started.
        //
        if(lstJobs.size() == 0)
        {
            // Schedule job to execute one minute in the future
            //
            Datetime schedulerTime = Datetime.now().addMinutes(1);
            String strScheduleTime = '0 ' + schedulerTime.minute() + ' ' +
                schedulerTime.hour() + ' ' + schedulerTime.day() + ' '+
                schedulerTime.month() + ' ? '+ schedulerTime.year();

            CompositeProjectImportScheduler scheduler = new CompositeProjectImportScheduler();
            System.schedule('Process CP records', strScheduleTime, scheduler);
        }
        else
        {
            System.debug('CP import scheduled job already pending.');
        }
    }
    
}


My Dev Console attempts
------------------------------------------------------------------------------------
first attempt
------------------------------------------------------------------------------------

System.schedule('HourlyRun', '0 0 * * * ?', new CompositeProjectImportScheduler() );

------------------------------------------------------------------------------------
second attempt
------------------------------------------------------------------------------------
CompositeProjectImportScheduler reminder = new CompositeProjectImportScheduler();
String sch = '0 0 * * * ?';
String jobID = System.schedule('HourlyRun2', sch, reminder);


Any advice would be most appreciated!

Thanks!


Michael
Hi there - I understand how web-to-case html works, but I would also like to have three additional things occur once a user/customer submits the form online i.e.
1) also somehow auto populate the info from the fields into a Contact record
2) automatically associate the case with the contact record
3) capture the info submitted into an email 

Here are the reasons why (Currently with our setup, we are using www.gravityforms.com to get the info submitted here (and other similar pages on our website) turksandcaicosreservations(dotcom)/request_a_quote/)
1) currently we have to take the info from the fields that that the user submits and manually created a contact record (very time consuming)
2) currently we have to manually do this
3)   currently the info submitted gets sent into a case and it automatically generates an email that our sales agents can simply 'reply' to when responding

Please help.

Thanks