function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
User 444User 444 

Can we call two different vf pages from custom button in salesforce using two different conditions, if yes how?

0
I am calling a vf page from a custom button if it meets a particular condition, but now I want to call another vf page if condition changes. Is it possible? and how to do it?
In below code, I want selected product = "anytwo"( if any two of T1, T2, T3 are active) condition displaying /apex/AP_productSelectionPage.(another vf page)
My code as of now displaying only one vf page:
/apex/AP_AgencySelectionPage?contactId={!Contact.Id}&selectionType=Register_Agency& selectedProduct={! if( and(Contact.IsT1Active__c,Contact.IsT2Active__c,!Contact.IsT3Active__c ), 'T3', if( and(Contact.IsT2Active__c,!Contact.IsT1Active__c,Contact.IsT3Active__c ), 'T1', if( and(!Contact.IsT2Active__c,Contact.IsT1Active__c,Contact.IsT3Active__c ), 'T2', if( and(!Contact.IsT2Active__c,Contact.IsT1Active__c,!Contact.IsT3Active__c ), 'T2', if( and(!Contact.IsT2Active__c,!Contact.IsT1Active__c,Contact.Ist3Active__c ), 'T1', if( and(Contact.IsT2Active__c,!Contact.IsT1Active__c,!Contact.IsT3Active__c ), 'T1' , if( and(Contact.IsT2Active__c,Contact.IsT1Active__c,Contact.IsT3Active__c ), 'Allthree' )))
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sravanthi,

Can you check if the below question is similar what you are looking for . If so please check the answer for the same.

https://developer.salesforce.com/forums/?id=9060G000000MSMsQAO

If this solution helps, Please mark it as best answer.

Thanks,