+ Start a Discussion
Rakesh SRakesh S 

Condition with custom button

Hi All,

I have two objects like Event and Registration. In both objects are having invoice as related list. From both objects, i want to create new Invoice. 
So that i want to create new custom button on invoice using URL with help of IF condition. because depending on object clicking that value should be auto populate field in new invoice page.
getting error like " URL No Longer Exists " and Address Bar showing like this: https://na16.salesforce.com/servlet/if(a04j0000009RESq)%7Bwindow.alert(You%20must%20populate%20the%20Field%20before%20using%20this%20button);%7Delse%7B/a0o/e?CF00Nj0000000OfdG=R-00103&CF00Nj0000000OfdG_lkid=a04j0000009RESq&retURL=%2Fa04j0000009RESq}

i tried like this 


I appreciate your help.

Thank you.
John LaJohn La
I think you will need to use Javascript if you're attempting this method.  You won't be able to use a URL button as it only accepts a URL and wont' handle If statements.
Sanjay Mulagada 11Sanjay Mulagada 11
Change you Button's Behavior type as "Execute JavaScript" and try this,