• StoneShot_Gaz
  • NEWBIE
  • 0 Points
  • Member since 2011

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

Hi,

 

I am currently trying to retrieve a set of list view options for a Lead object from a StandardSetController. When I look at the SelectOptions that are returned (from getLeadExistingViews) I only recieve the All option in my list. The end result I would like is the list view options for the standard Lead page (All Open Leads etc.) Your help would be much appreciated. Markup and code below.

 

Gaz

 

EmailPreferenceAddMembers.page

<apex:page standardController="Email_Preference_Member__c" recordSetVar="members" extensions="EmailPreferenceAddMembersExtensions">
  <apex:sectionHeader title="{!$ObjectType.Email_Preference__c.Label}" subtitle="Add Members" />
  <apex:form >
  <apex:outputPanel style="margin-bottom: 1em;" layout="block">&laquo;&nbsp;<apex:outputLink value="http://example.org" style="color: #015BA7; text-decoration: none;">Back to Email Preference: My Email Preference</apex:outputLink></apex:outputPanel>
  <apex:pageBlock >
      <apex:pageBlockSection title="Step 1: Choose Member Type to Search">
          <apex:selectRadio >
              <apex:selectOption itemLabel="Leads" itemValue="Leads" ></apex:selectOption>
              <apex:selectOption itemLabel="Contacts" itemValue="Contacts" ></apex:selectOption>
          </apex:selectRadio>
      </apex:pageBlockSection>
      <apex:pageBlockSection title="Step 2: Specify Filter Criteria">
          <apex:pageBlockSectionItem >
          <apex:outputLabel value="Use Existing View" />
              <apex:selectList value="{!leadFilterId}" size="1">
              <apex:selectOptions value="{!LeadExistingViews}"></apex:selectOptions>
              </apex:selectList>
          </apex:pageBlockSectionItem>
      </apex:pageBlockSection>
      <apex:facet name="footer">
          <apex:commandButton value="Go!" style="margin: 1em; width: 3em;" />
      </apex:facet>
  </apex:pageBlock>
  </apex:form>
</apex:page>

 EmailPreferenceAddMembersExtensions.cls

public with sharing class EmailPreferenceAddMembersExtensions {

    public ApexPages.StandardSetController leadsController {get; set;}
    public String leadFilterId {get; set;}

    public EmailPreferenceAddMembersExtensions(ApexPages.StandardSetController controller) {
        leadsController = new ApexPages.StandardSetController(Database.getQueryLocator([select Id, Name from Lead]));
        leadFilterId = leadsController.getFilterId();
    }
    
    public SelectOption[] getLeadExistingViews() {
        return leadsController.getListViewOptions();
    }
}

 


Hi there 


If I were to use the cron expression '0 31 12/2 8/1 7/1 ? 2011/1' (I would like to schedule a job starting from 12:31pm 08/07/2011 which fires every 2 hours as an example), would this expression 

a) fire every 2 hours indefinitely or 
b) fire every 2 hours until the end of that day/month/year?

 

Any help would be greatly appreciated.

Hi there

Is there a way of aborting a scheduled job that is currently in the 'Waiting' status? I have an Apex controller which is designed to create/update a schedule based on the settings provided by the user (in this case a system administrator). The schedule controls sync between SalesForce and an external web service.

The schedule is recurring on a daily or weekly basis, I have tried using the System.abortJob() method to abort the job but this does nothing. Since I cannot abort the job, I then cannot re-schedule the job with the same name. Scheduling under a new name would soon run into trouble due to limits.

//TEST
schedule = '0 40 */2 * * ?';

if (scheduleId.Value__c != '') {
            List<CronTrigger> ct = [select Id from CronTrigger where Id = :scheduleId.Value__c];
            
            if (ct.size() > 0) {
            	for (CronTrigger c : ct) {
            	system.debug('attempt to abort job');
                system.abortJob(c.Id);
                system.debug('job aborted');
            	}
            }
        }
        
        ScheduledSync sSync = new ScheduledSync();
        String syncResult = system.schedule('Sync', schedule, sSync);
        
        scheduleId.Value__c = syncResult;
        
        update scheduleId;

 
Any help would be greatly appreciated.

Regards
Gaz