• Ebrahim Abdulsattar
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
Hello and thank you for your assistance in advance! I have a simple Javascript button that isn't working in Lighting, so I would apprecaite any help I get to make it work in my org. 
 
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} 

var result = sforce.apex.execute("WebServices_Batch","ApproveAllTransactions",{batchId: '{!Batch__c.Id}' }); 

if(result == 'SUCCESS'){ 

window.location.reload(); 
} 
else if(result == 'BatchAmountMismatch'){ 
alert('There is still a balance remaining for this batch'); 
} 
else{ 
alert('There was an error updating. Please contact your administrator.'); 

}

 
I'm trying to create a trigger to rank sales team members for this week, last week and this month. this is based on events/activities object. I created a new custom object with the following fields:
User
Rank
Score
Date/Time

and what I want to achieve is to run this trigger every hour to gather all the changed status events with in the last hour and calculate few fields from the events and add them to the Score field in my object. Once the score is added, then I'd like to rank the users based on their score.


Thank you!