Last active
August 29, 2015 14:17
-
-
Save miragedeb/34aafd27de7360d946e3 to your computer and use it in GitHub Desktop.
TaskOpenerController
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class TaskOpenerController{ | |
public List<QA_Release__c> releases {get;set;} | |
public Integer numberOfReleases {get;set;} | |
public Id qaId {get;set;} | |
public DateTime creDate {get;set;} | |
private Id releaseClientId; | |
public Decimal difference {get;set;} | |
public TaskOpenerController (ApexPages.StandardController stdcontroller) { | |
//Extract the Id of the current QA Release record | |
qaId = stdController.getId(); | |
//Extract the client Id from the above record | |
QA_Release__c qaRel = [SELECT Client__c,CreatedDate FROM QA_Release__c WHERE Id= :qaId ]; | |
releaseClientId = qaRel.Client__c; | |
creDate = qaRel.CreatedDate; | |
System.debug('Record creation date is: ' + creDate); | |
difference = Decimal.valueOf((DateTime.now().getTime() - creDate.getTime())/1000) ; | |
System.debug(' Difference between Now and Record Creation is: ' + difference + ' seconds'); | |
//Find all records excluding the current record that have above client as account | |
releases = [SELECT Id | |
FROM QA_Release__c | |
WHERE Id!= :qaId AND (Client__c= :releaseClientId AND | |
(Status__c='Not Started' OR Status__c = 'In Progress' OR | |
Status__c = 'On Hold' OR Status__c ='Re-opened'))]; | |
numberOfReleases = releases.size(); | |
System.debug('Number of Releases for this account is: ' + numberOfReleases); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment