You need to sign in to do that
Don't have an account?
David Gunn
Change custom "New Quote" URL button to javascript button
In our instance we have a custom quote button (URL button) that only contains this code:
/apex/NewQuoteRedirect?retURL=%2F{!Opportunity.Id}&oppid={!Opportunity.Id}
I would like to change this to an OnClick Javascript button to which I can add some validation code (to make sure a new Opportunity Product custom field is populated in each of the opportunity's products)
How can I convert the above line to Javascript?
/apex/NewQuoteRedirect?retURL=%2F{!Opportunity.Id}&oppid={!Opportunity.Id}
I would like to change this to an OnClick Javascript button to which I can add some validation code (to make sure a new Opportunity Product custom field is populated in each of the opportunity's products)
How can I convert the above line to Javascript?
Thanks to the link Karanraj gave me I found the code in that page used parent.window.location, so I used that and it now works:
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
// Do some validation here
parent.window.location = '/apex/NewQuoteRedirect?retURL=%2F{!Opportunity.Id}&oppid={!Opportunity.Id}';
Thanks to both of you for your quick replies.
All Answers
You can create javascript button using below code :
If this solves your problem, kindly mark it as the best answer.
Thanks,
Vatsal
Thanks to the link Karanraj gave me I found the code in that page used parent.window.location, so I used that and it now works:
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
// Do some validation here
parent.window.location = '/apex/NewQuoteRedirect?retURL=%2F{!Opportunity.Id}&oppid={!Opportunity.Id}';
Thanks to both of you for your quick replies.