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');    
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.

  • it gives error- salesforce a problem with the onclick javascript for this button or link was encountered – user24524 Sep 8 '15 at 9:57
  • @user24524 can you share your code. – Tushar Sharma Sep 8 '15 at 10:01
  • @user24524 i am happy that it solve your problem :) – Tushar Sharma Sep 8 '15 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');
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.