• Josephto
  • NEWBIE
  • 0 Points
  • Member since 2010

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

I need to create an APEX Trigger that will sum all Cases (Opened in the Last 7 Days) to a field on the Account Level.  But, I am APEX defficient...  ANy suggestions or ideas?

I have written some code to update a check box from a custom button.  However, I continue to get an error that says" "missing ; before statement"

 

Here is my code;

 

{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
var theId ="{!Contact.Id}";
var c = new sforce.SObject("{!Contact.Id}");
var objectsArray = [];
c.Id = {!Contact.Id};
Contact.Andon_Cord_Flagged__c = 1;

//Push the Update
var callCompleted = false;
objectsArray .push(c);
try{
    var result = sforce.connection.update(objectsArray );
    callCompleted=true;
}
catch(error){
   alert ("En error occured : " + error);
}

if (callCompleted){
   for (var i=0;i<result.length;i++){
         if (!result[i].getBoolean("success")){
             alert ("Error encountered while updating record id " + theId + " : " + result[i].error);
             }
         }
     //Reload Window
    window.location.reload(true);  }

 

 

ANY IDEAS?

Message Edited by Josephto on 03-18-2010 07:38 AM

I need to create an APEX Trigger that will sum all Cases (Opened in the Last 7 Days) to a field on the Account Level.  But, I am APEX defficient...  ANy suggestions or ideas?

I have written some code to update a check box from a custom button.  However, I continue to get an error that says" "missing ; before statement"

 

Here is my code;

 

{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
var theId ="{!Contact.Id}";
var c = new sforce.SObject("{!Contact.Id}");
var objectsArray = [];
c.Id = {!Contact.Id};
Contact.Andon_Cord_Flagged__c = 1;

//Push the Update
var callCompleted = false;
objectsArray .push(c);
try{
    var result = sforce.connection.update(objectsArray );
    callCompleted=true;
}
catch(error){
   alert ("En error occured : " + error);
}

if (callCompleted){
   for (var i=0;i<result.length;i++){
         if (!result[i].getBoolean("success")){
             alert ("Error encountered while updating record id " + theId + " : " + result[i].error);
             }
         }
     //Reload Window
    window.location.reload(true);  }

 

 

ANY IDEAS?

Message Edited by Josephto on 03-18-2010 07:38 AM