Sunday, September 22, 2013

Salesforce: Log A Call with Activity Type auto populated

Type is a standard picklist field in Salesforce Activity object. User can add / remove values in the picklist.

When user click "Send an Email" button from Activity History related list of Account, Contact, Opportunity, or from any other object page layout, system admin can define default value equal to "Email" (for example). So, task created will be always assigned to Email.

But, when user click "Log A Call" button (also in Activity History related list ), Type will be blank. This is not ideal, system should be smart enough to auto-populate Type to Call (or any other value default in the system set by system admin).

Is the any workaround? YES. Here we go:
  • Create a custom button from: Setup - Customize - Activities - Task Buttons, Links, and Actions
  • Click "New Button or Link" button
  • Enter following data as screenshot below:
  • Click "Save" button to save it.
  • Go to object page layout, such as Contact page layout, edit the page layout and scroll to "Activity History" related list
  • Untick standard "Log A Call" button and add custom button created above

  • Done
But, here is the downside, if you notice in screenshot above, you see many buttons: "Contact Log A Call", "Account Log A Call", etc... this is because you need a button for each object. This is caused by the URL in the button

See there is Contact Id in who_id parameter, and for Account and Opportunity, you need to put their Id to what_id parameter.