Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {!REQUIRESCRIPT("/soap/ajax/9.0/connection.js")}
- var count = '{!Contract.Count__c}';
- if(count > 300)
- window.parent.location.href = "/apex/page1?id={!Contract.Id}";
- else
- window.parent.location.href = "/apex/page2?id={!Contract.Id}";
- <apex:page standardController="Contract" extensions="myControllerExtension" action="{!Redirect}">
- public class myControllerExtension {
- private final Contract Contract;
- public myControllerExtension(ApexPages.StandardController stdController) {
- this.Contract = (Contract)stdController.getRecord();
- }
- public PageReference redirect() {
- //Query with necessary Id for your field
- Contract = [Select Id,Count from Contract limit 1];
- if(Contract.count>300){
- return pagereference ('/page1?'+ContractId);
- }else{
- return pagereference ('/page2?'+ContractId);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement