+ Start a Discussion

Cannot do two things at once!


If anyone can help me it would be most appreciated.


I need to do two things at once....



1. Click a custom button on account page, which launches a visualforce page (opening in Word)  with the accuont details in a formatted style (our new customer form), which our team can then print out.   This bit I can do


2. At the same time, update a field on the account page with today's date, to let salesforce know what date they were signed up on.  This could provide valuable data to start analysing.


Can anyone help ?


It feels like either my visual force page also needs some code to update the account 'closed date' field


Or I need the custom button to execute javascript that updates the 'closed date' field and then launches the visualforce page.



Not sure if possible ?


Not sure what you mean by the first requirement. However, if you want to perform some DML operation just before a VF page is loaded, use the pageAction attribute on <apex:page /> - I think this is what you want?





For second task, you will need to execute the javascript on Account page but javascript will change the value on UI you also have to execute Ajax, JavaScript Remoting or on the Action method of New page to change the value of Account (DML operation).