Wednesday, June 29, 2011

Tips&Tricks: Records Created By the Current User

Here's a little formula that I came up with that comes in handy when you need to create reports and dashboards that display things like Activities, Cases, Leads, Opportunities, etc that were created by one user, but might now be owned by another user.
Unfortunately the built-in Salesforce "My..." and "My Team..." filters only reference the record Owner field, so you're forced to clone reports and edit the Created By filter (making the Running User pretty much useless)

Until now....

Here's what you do:

Create a custom field on the objects that you need to track CreatedBy (User).
Field Name: CreatedBy$User
Datatype: Formula
Return Type: Number, 0 decimals
Formula: IF(CreatedById = $User.Id , 1, 0)

Now just add a simple filter:
Field: CreatedBy$User Operator: [equals] Value: 1

to your reports and now use the Running User to create Scheduled Reports and Dashboards that display anything a user created. Now if you need to create a new "Created By... Dashboard" all you have to do is clone the Dashboard and change the Running User (no more cloning and editing reports for each user)

it also works with List Views too!


Monday, June 13, 2011

Reset Reminder Button - A fix for the Dismiss All Reminder Pop-up window


Oops! I Didn’t Want to Dismiss All  by Kyle Thornton

The infamous Matt Brown threw out a question the other day
After some back and forth with Matt it turned out there are many questions on the Salesforce.com Answers forums related to getting reminders back after a user clicks ‘Dismiss All’ on the reminders pop up. I decided to give this a stab and the following is the result.
I created a Visualforce Page that simply has a button on it along with a disclaimer of what the button will do.
The main purpose of the controller is to query for all open tasks and future events owned by the current user and set the reminder flag to true, allowing them to show up in the reminder pop-up when logging in. The controller will not set the reminder flag for any Tasks that never had a reminder set.  We know this because the Reminder Date is null.  Had it been set previously, it would still be set; the reminder flag was just unchecked.

Finally, I created a very simply home page component with a link to the visualforce page. The component name is “Reset Reminders For My Open Tasks and Event” and the html (be sure to check the ‘show html’ checkbox) is:


My only change would be here and replace the section of code that created the below Homepage component:
 with a button. The button on the Homepage looks like this:
Here is the code for the button:


I figured the easiest way to show the functionality was with a quick demo.

Finally, you can install an unmanaged package of the home page component (don’t forget to add it to a page layout), visualforce page, controller and test method with this link:
*Remember, you can change the path to https://test.salesforce.com… to install to a sandbox.

This excellent Post was from a fellow blogger Kyle Thornton over on his blog knthornt.wordpress.com