You need to sign in to do that
Don't have an account?

non working if statement on custom button
Hi,
I am trying to create a custom button with an if statement to use on a quote detail page. Sample code as follows;
{!IF
(
TEXT(Quote.Status)<>"Akzeptiert",
URLFOR("/apex/SalesFlowCreateOrderContract"),
'/flow/Quote_to_Order_with_Contract?QuoteID="{!Quote.Id}&"retURL=/"{!Quote.Id}'
)}
On the first option, the code tries to redirect to a VF page which works perfectly. But if statement continues on to the second option either I get encoding errors or non-working if statement depending on the syntax I tried to avoid errors. I tried to use URLENCODE but it did not work too.
Is there anyone who may share ideas on this?
thanks
Alper
I am trying to create a custom button with an if statement to use on a quote detail page. Sample code as follows;
{!IF
(
TEXT(Quote.Status)<>"Akzeptiert",
URLFOR("/apex/SalesFlowCreateOrderContract"),
'/flow/Quote_to_Order_with_Contract?QuoteID="{!Quote.Id}&"retURL=/"{!Quote.Id}'
)}
On the first option, the code tries to redirect to a VF page which works perfectly. But if statement continues on to the second option either I get encoding errors or non-working if statement depending on the syntax I tried to avoid errors. I tried to use URLENCODE but it did not work too.
Is there anyone who may share ideas on this?
thanks
Alper
I think it is due to ! before if:
Please use below code: Hope this will help. Please mark answer if helped.
Regards,
Ramakant
unfortunately removing the exclamation mark resulted printing the code in the URL instead of executing it.
cmydomain.cs88.my.salesforce.com/servlet/%7Bif(TEXT(Quote.Status)%3C%3EAkzeptiert,URLFOR(/apex/SalesFlowCreateOrderContract),%27/flow/Quote_to_Order_with_Contract?QuoteID=0Q09E000000AyPi&retURL=/0Q09E000000AyPi%27)%7D
regards
Alper
While playing around I found the solution, custom button code should be as follows;
cheers
Alper