2

I´m quite new on Salesforce, and I have found a lot on some of this, but nothing on how to exactly do it.

Does anyone have any idea on how to create a Custom Button on the Accounts Page Layout. I need this to keep track on whenever it is clicked, and collect the data on when (date and time) it was clicked, who clicked it, and just a record on how many times it has been clicked. Also being able to reset that counter monthly.

Also, i would like to be able to track and create reports from this data.

Thanks,

1

You can create a custom object to track the clicks. You can then put the following code in the button (execute JavaScript):

{!REQUIRESCRIPT("/soap/ajax/35.0/connection.js")} 

var record = new sforce.SObject('MySObjectAPIName__c');
sforce.connection.create([record]);

With this code in the button Salesforce will create a record of your specific object when the user clicks it. Since the SObject class has the standard fields CreatedById and CreatedDate you can use those to know who and when it was clicked. Of course, if a user clicks multiple times, then multiple records will be created, so you can use the record count to count how many times the button was clicked.

You can reset the counter by deleting the records monthly, or by using a filter in the report (specifying the limits on CreatedDate).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.