Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. {!REQUIRESCRIPT("/soap/ajax/9.0/connection.js")}
  2.  
  3. var count = '{!Contract.Count__c}';
  4. if(count > 300)
  5. window.parent.location.href = "/apex/page1?id={!Contract.Id}";
  6.  
  7. else
  8. window.parent.location.href = "/apex/page2?id={!Contract.Id}";
  9.  
  10. <apex:page standardController="Contract" extensions="myControllerExtension" action="{!Redirect}">
  11.  
  12. public class myControllerExtension {
  13.  
  14. private final Contract Contract;
  15.  
  16. public myControllerExtension(ApexPages.StandardController stdController) {
  17. this.Contract = (Contract)stdController.getRecord();
  18. }
  19.  
  20. public PageReference redirect() {
  21. //Query with necessary Id for your field
  22. Contract = [Select Id,Count from Contract limit 1];
  23. if(Contract.count>300){
  24. return pagereference ('/page1?'+ContractId);
  25. }else{
  26. return pagereference ('/page2?'+ContractId);
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement