0

I have Custom button name as "Create reservation" where i execute javascript. Which is on "Property Object" When custom picklist field value equals to "Available" then it should redirect to another page otherwise no action perform from "Create reservation" button. How to do it? actually m newbie in salesforce. Here my OnClick JavaScript-

window.open('/apex/Create_Reservation?kk={!Property__c.Id}','_blank');    

2 Answers 2

1

you can check the value in javascript. Something like

If('{!custom_picklist}' == 'Available')
    window.open('/apex/Create_Reservation?kk={!Property__c.Id}','_blank'); 

try this. it will solve your problem.

3
  • it gives error- salesforce a problem with the onclick javascript for this button or link was encountered
    – user24524
    Sep 8, 2015 at 9:57
  • @user24524 can you share your code. Sep 8, 2015 at 10:01
  • @user24524 i am happy that it solve your problem :) Sep 8, 2015 at 10:05
0

It's Working-

{!REQUIRESCRIPT("/apex/Create_Reservation")}

var prop = "Available";
var propStage= '{!Property__c.Status__c}';
if (propStage!=prop)
{
alert("Please note - You can only create a reservation on available property.");
}
else {

window.open('/apex/Create_Reservation?kk={!Property__c.Id}','_blank');
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .