You need to sign in to do that
Don't have an account?
![lakshman.matti lakshman.matti](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Last Fiscal year revenue
HI,
i have created a custom field in account object called Prevoius Fiscal Year Revenue.
This field needs to be created and should allow for population via batch apex that can be run when the year ends. Button to start batch should be available on the account Detail page.
Can some body give suggestion on how to create a button to achieve functinality.
Thanks in advance
i have created a custom field in account object called Prevoius Fiscal Year Revenue.
This field needs to be created and should allow for population via batch apex that can be run when the year ends. Button to start batch should be available on the account Detail page.
Can some body give suggestion on how to create a button to achieve functinality.
Thanks in advance
But, let's go with this assumption for now.
I would do a few steps...
-
Create a VisualForce page with the Account as a Standard Controller and an extension of a Custom Apex class. In the "happy path" scenario, this VF page won't be displaying anything. In the event of some nasty error, this page should probably display any errors. In the case of an error being displayed, don't forget to add a "Back to Account" button. Good UX is still a must :-) Within the Page tag of the VF Page, I'd use the "action" attribute to call a method named "executeBatchJob" on the Custom Controller.
-
Within the Custom Controller's "executeBatchJob" method, you can kick off your batch job. I recommend always putting the Batch Size as a Custom Setting so that you can fine tune your app later. If the Batch Job submits properly, I'd return the user back to the Account. You can get the Account Id from the Standard Controller that will be passed into the Controller's constructor.
-
I'm assuming you have the batch job written and the Account Id is passed in as a Parameter to the Constructor or from a Setter.
Hope this helps!Thanks for the reply.
can u provide me the psedo code please..
Thanks
Lakshman