Entries in Custom Fields (4)


APEX: Retrieve a Custom Object Field's History

Let's say you have the field "Address" in a custom object labeled "Customer" and you're looking to obtain that particular field's history and tracking details along with the dates on which changes were made. Today, I'll share a query that will help you do just that:


SELECT ParentId, OldValue, NewValue, Field, CreatedById, CreatedDate FROM Customer_History where parentId = :CustomerId and Field ='Address__c'

Turn a Salesforce Hyperlink into a Button:


If you're using Salesforce and have a Hyperlink that uses formula fields, you can make it stand out as an action by converting it into a Salesforce button. Here is what you need to do: 


  1. Create an image of the button and store it as a document
  2. Create a Hyperlink field 
  3. Use the following code to convert the Hyperlink into a button

 HYPERLINK("/servlet/servlet.Integration?lid=01N300000008kgN&eid=" & {!Id} , IMAGE("/servlet/servlet.Images?oid=00D304011111xYG&id=0153111110400F5uW", "Create a New Opportunity"))

Here is how the code functions:


  • The first half of the code builds the link
  • The second half of the code displays the image you created for the button



That's it!


Tell me in the comments how this could be helpful as an admin!





Map Account Fields to Contact Fields

Here is how to map Salesforce Account fields to Contact fields:

You probably hvae information in your Account object (like Annual Revneues, Number of Employees...) that you may want to make visible for sales people and perhaps other department in your organization too. Also, you may want these fields to be mapped and synced at the individual contact level. Here is how to map Salesforce Account fields to Contact fields:


  1. Go to Steup> App Setup> Customize> Contacts> Fields, then create a new custom field.
  2. In Wizard Step1, create a new custom contact field with Data Type: Formula.
  3. In Wizard Step2, enter the field lable, then select the data format.
  4. In Wizard Step3, click "Advanced Formula" tab, then click "Insert Field".
  5. Choose Contact> Account and pick the Account field you want to map your Contact field to
  6. Click "Insert" button
  7. set the Blank Field Handling to "Treat blank fields as blanks"


Finally, don't forget to choose the page layout you want teh custom field to bee added to, then click "Save". 


That's it!


Find Records Owned by Inactive User

#3 Rock on.

p.s. This could also work for a less dramtic scenario, i.e. when user is simply no longer active.

Click to read more ...