• Catco CRM
  • NEWBIE
  • 0 Points
  • Member since 2006

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

Is anyone familiar with this program. The Set Up Guide provided an apex trigger code as an example however I continue to receive a warning message everytime I save this trigger.  Is there something wrong with the code?
ErrorError: Compile Error: unexpected token: at line 1 column 9

trigger batchRun on cron__Batch_Run__c (before insert, before update) {

// This Apex trigger is designed to fire when the batch workflow scheduler
// checks the Trigger Batch Run checkbox or when changes are made to the Batch Run
// record manually.


Boolean error = false; // Var used by each batch job to flag and return an error to the Batch Run object.
String results = ''; // Batch job results, also returned to the Batch Run object.

for (cron__Batch_Run__c batchRun : Trigger.new) {
System.debug(batchRun);

if ( batchRun.cron__Completed__c != null) {
System.debug('Job is already completed');
continue; // Job has alread run, skip all this

}


if ( batchRun.cron__Trigger_Batch_Run__c == true ) {

System.debug('Trigger Batch Run set. Running batch job.');

// --------------- Batch Job Housekeeping --------------------
Datetime lastrun = Datetime.now();
Datetime nextrun;
if(batchRun.cron__Run_Every_Units__c == 'Days') {
nextrun = lastrun.addDays(batchRun.cron__Run_Every__c.intValue());
} else {
nextrun = lastrun.addHours(batchRun.cron__Run_Every__c.intValue());
}
if (nextrun < Datetime.now()) {
nextrun = Datetime.now();
}

// Create the next Batch Run and configure it so that the scheduler workflow
// adds a Trigger_Batch_Run field update in the time-based workflow queue.
cron__Batch_Run__c newJob = new cron__Batch_Run__c(
cron__Scheduled_To_Run__c = nextrun,
cron__Trigger_Batch_Run__c = false,
cron__Batch_Job_Name__c = batchRun.cron__Batch_Job_Name__c,
cron__Batch_Job__c = batchRun.cron__Batch_Job__c,
cron__Run_Every__c = batchRun.cron__Run_Every__c,
cron__Run_Every_Units__c = batchRun.cron__Run_Every_Units__c,
cron__Trigger_Scheduler_1__c = true);
insert newJob;

// Update the current Batch Run dates and uncheck batch job trigger
batchRun.cron__Completed__c = lastrun;
if (batchRun.cron__Scheduled_To_Run__c == null) {
batchRun.cron__Scheduled_To_Run__c = lastrun;
}
batchRun.cron__Trigger_Batch_Run__c = false;

// ------------ End Batch Job Housekeeping -------------------


// ----------- Begin batch jobs -----------------
if (batchRun.cron__Batch_Job_Name__c == 'Sample Batch Job') {
error = false;
results = '';

// Insert your Apex code here... be sure to set vars 'error' and 'results' to
// pass batch results back to the Batch Run object.

}

// ----------- End batch jobs -----------------

// Report Governor Limit Stats and set return values
String limitText = 'Aggregate Queries: '+
Limits.getAggregateQueries() +'/' +
Limits.getLimitAggregateQueries();
limitText += '\nSOQL Queries: '+
Limits.getQueries() +'/' +
Limits.getLimitQueries();
limitText += '\nQuery Rows: '+
Limits.getQueryRows() +'/' +
Limits.getLimitQueryRows();
limitText += '\nDML Statements: '+
Limits.getDMLStatements() +'/' +
Limits.getLimitDMLStatements();
System.debug(limitText);

batchRun.cron__Results__c = results;
batchRun.cron__Results__c += '\n\n'+limitText;
if (error) {
// write error to batch run notes field and set error flag
batchRun.cron__Result__c = 'Error';
} else {
batchRun.cron__Result__c = 'Success';
}

} else { // end if trigger batch job flag set
System.debug('Refreshing time-based workflow queue');
// Alternate Trigger Scheduler flags to keep workflow queued and current
if (batchRun.cron__Trigger_Scheduler_1__c == false) {
batchRun.cron__Trigger_Scheduler_1__c = true;
batchRun.cron__Trigger_Scheduler_2__c = false;
} else {
batchRun.cron__Trigger_Scheduler_1__c = false;
batchRun.cron__Trigger_Scheduler_2__c = true;
}

}

}
}

Hello,

I am trying to create a queue for Contacts, we currently have two for leads, but there are no options in custom objects for Contacts is there a way around this?

Cheers,

Katherine
Hello All,

I am trying to create a formula with willl alert a broker that there has been no activity in the last 90 days. Since the last acitivity is not an option for a leads  page layout I have to insert a field. I tried severl times to create a formula
LastActivityDate  >(2/23/2008)
LastActivityDate  >2/23/2008 (expression) )
LastActivityDate  >  TODAY(2/23/2008)

I guess Im really off. :)

I have requirement like this.

Build a custom page to search   Events in the salesofrce. Based on search criteria like Date or subject etc and a result page.

If user A shared is Calendar with user B then when user B logins and serch for the events I need to show all the events that user B have the access. ie I need to show the calendar events for user A and user B.

I am not sure how do I check through the code to see if the Calendar is shared to user B or Not. Could any one tell me how can I do this check through an scontrol? Is it possible to do this kind of checking?

Thanks



Message Edited by das on 05-23-2008 02:22 PM
Hello All,

I am trying to create a formula with willl alert a broker that there has been no activity in the last 90 days. Since the last acitivity is not an option for a leads  page layout I have to insert a field. I tried severl times to create a formula
LastActivityDate  >(2/23/2008)
LastActivityDate  >2/23/2008 (expression) )
LastActivityDate  >  TODAY(2/23/2008)

I guess Im really off. :)