You need to sign in to do that
Don't have an account?
Custom Button that populates opportunity name with Account Name - Year
I have a custom button for New Opportunity that pre-populates the Opportunity Name with "ACCOUNT NAME - ".
How can I change this button to also include the current year after the account name: "ACCOUNT NAME - 2010"?
Here is what I have right now:
/setup/ui/recordtypeselect.jsp?ent=Opportunity&save_new_url=/006/e?retURL=%2F{!NULLVALUE(Contact.Id, Account.Id)}&accid={!Account.Id}&conid={!Contact.Id} &lookupcmpgn=1&opp3={!Account.Name} -
Here is what I tried, but it didn't work:
/setup/ui/recordtypeselect.jsp?ent=Opportunity&save_new_url=/006/e?retURL=%2F{!NULLVALUE(Contact.Id, Account.Id)}&accid={!Account.Id}&conid={!Contact.Id} &lookupcmpgn=1&opp3={!Account.Name} - (year(date()))
Any idea how to get this to work? Right now I just depend on sales to populate the year, but many are not doing it.
Thanks!
Change your Button content to execute javascript from URL
then use
window.location=urlString;
it will work :)
Thanks,
Bala
All Answers
var year=(new Date()).getFullYear();
/setup/ui/recordtypeselect.jsp?ent=Opportunity&sav
e_new_url=/006/e?retURL=%2F{!NULLVALUE(Contact.Id, Account.Id)}&accid={!Account.Id}&conid={!Contact.Id} &lookupcmpgn=1&opp3={!Account.Name} -+ year
try this one,
year will represent current year append same in your URL after account.
Hope this wll help you
Thanks,
Bala
It let me save your code into the custom button, but then when I click the button it tells me URL No Longer Exists. I'm guessing because the first line is not a URL and the content source for the custom button is set to URL.
Change your Button content to execute javascript from URL
then use
window.location=urlString;
it will work :)
Thanks,
Bala
Hey guys,
I have a similar question and I'm not developer, so bear with me. I have a custom object and want to create a custom button on the detail page that generates a new opportunity record and populates the opportunity name with one of the fields on the object. I have several opportunity record types, so the button needs to generate a specific opportunity record type. Can you help by providing me the code I need to use in the button? Your help is appreciated.