function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ApolloSApolloS 

How to create a custom Activity button that creates new Activity and sets custome picklist?

Right now we have Log a Call and Send an Email buttons under our Accounts, Contacts, and Opportunities.

 

I would like to add two more buttons.

 

Left Voicemail - sets Activity custom picklist field Activity_Type__c to value LVM and Subject to LVM

Bad Number - sets Activity custom picklist field Activity_Type__c to BadNum and Subject to Bad Number

 

How do I do that?

sfdcfoxsfdcfox

1. Create custom buttons under Setup > App Setup > Customize > Activities > Buttons and Links.

 

2. Set the type to URL, behavior to "open in same window", make sure it is a "list button", and use a formula similar to the following:

 

 

{!URLFOR($Action.Task.New,null,[tsk5="LVM",CF00Nxxxxxxxxxxxx="LVM"],true)}

Where tsk5 is the name of the subject field, and CF00Nxxxxxxxxxxxx is the ID of the custom field (use View Source to find the correct ID to use).

 

Use the same technique for the other button.

 

3) Once saved, add the button to the related list by going to Setup > object > Page Layouts, scroll to the appropriate related list, click the configure button, and add the custom button. You'll need to do this once for each page layout you want it to appear on (potentially hundreds).