Salesforce scheduling buttons for Opportunities

A schedule button on the Opportunity record allows quick scheduling with the Opportunity’s related contact record. Bookings made via this link will be automatically added to the contact record and the contact making the booking will not have to provide any information that already exists for this record. Direct scheduling buttons can be used in two ways:

  • The Booking page link can be copied and sent to the customer
  • The Salesforce user can schedule on behalf of the customer

Direct scheduling buttons can be configured to prepopulate the booking form or skip it altogether. This is enabled by the Optional mapping step in the ScheduleOnce Salesforce setup wizard where you can define the mapping between record fields and booking form fields. In this article, you will learn how to add the Schedule with related Contact button to the Opportunity record page layouts in Salesforce.

Requirements

To add the Schedule with related Contact button to the Lead, Case, Contact Page layouts in Salesforce, you will need:

ImportantThe Salesforce Lightning experience does not support OnClick Javascript buttons. If you are switching to the new Lightning experience, you can either invoke Apex classes in the process  builder, or add a javascript controller for the Lighning Design System. Learn more about using OnClick Javascript button with the Salesforce Lighning experience

Create Lookup field API

First, we will add a Lookup custom field to the Opportunity record.

  1. Log in to Salesforce.
  2. In your Salesforce Setup page, go to App Setup > Customize.
  3. Select the Opportunity object and then Fields.
  4. Click New, select Lookup Relationship and Next.
  5. In the Related to drop-down, select Contact and Next.
  6. In the Step 3. You will enter the label and name for the lookup field:
    • Label: Contact
    • Name: Contact_ID
  7. Follow the steps and add the lookup field to the Page layouts.

Create Custom buttons in Salesforce

Now you can create the button to add to the Opportunity page layout. The button will retrieve the Contact ID from the Custom Contact lookup field. When clicked, you will be able to make a booking on behalf of the Contact added to that Opportunity.

Note You can also follow the steps below for Custom objects. In this case, the button and the Lookup custom field should be added to a Custom object instead of the Opportunity page layout.

To create a button field to the Opportunity Page layout:

  1. In your Salesforce Setup page, go to App Setup > Customize.
  2. Select the Opportunity object and then Buttons, Links, and Actions.
  3. Enter the following information (see Figure 1):
    • Label: Schedule with related Contact
    • Name: Schedule_with_related_Contact
    • Description: This button allows you to schedule meetings on behalf of the Contact related to this Opportunity record.
    • Display Type: Detail Page Button 
    • Behavior: Execute Javascript
    • Content Source: OnClick Javascript
  4. In the Code below, first replace the red text by your Booking page and insert the lookup field API name that you have created previously. Once completed, copy and paste the updated code in the Code box.
  5. Paste the updated code in the Code box:

    window.open("your booking page link&Skip=1&sfLeadId={!Lead.Id}&sfContactId={!<your_lookup_field_API_name>}&sfCaseId={!Case.Id}", "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=200, left=200, width=900, height=600")
  6. Click Save.

Figure 1: Schedule with related Detail Page button

Add the Schedule with related Contact button to Standard Objects Page layouts

Now you just need to add the button to the relevant Salesforce Opportunity Page layouts.

NotePage layouts control which buttons are visible. If you want to display the buttons only to specific Salesforce Users, you can assign your Page layouts to specific Users. Learn more

  1. In your Salesforce Setup page, go to App Setup > Customize.
  2. From the Opportunity, select Opportunity Page Layout (see Figure 2).
  3. On the Page Layout page, select Buttons.
  4. Click and drag the Schedule with related Contact button to the Custom buttons area (see Figure 2).

    Figure 2. Opportunity Page layout.

  5. When you have completed your edits, click the Save button.
Was this article helpful?
Thank you for your feedback!