---
title: "SFDC Flow:  Add a Custom Button"  
description: "In my previous post SFDC Flow: Add a Confirmation Screen, we learned how to add a confirmation screen in SFDC flow. After this, here we see how to add"  
author: "Anonymous User"  
published: 2015-03-23  
updated: 2018-02-22  
canonical: https://www.mindstick.com/blog/10852/sfdc-flow-add-a-custom-button  
category: "sales force"  
tags: ["cloud computing", "cloud", "cloud development", "sfdc", "dev-401"]  
reading_time: 3 minutes  

---

# SFDC Flow:  Add a Custom Button

In my previous post [SFDC Flow: Add a Confirmation Screen](https://www.mindstick.com/Blog/10851/SFDC%20Flow%20Add%20a%20Confirmation%20Screen#.VQ_QYFy6bIU), we learned how to add a confirmation screen in SFDC flow. After this, here we see how to add a custom button to launch the SFDC flow

#### \

#### Add a Custom Button

#### \

Now that we have a flow, let’s add a custom button so that users can launch the flow from the invoice detail page. The button will:

- Launch the flow specified by the flow URL. You can find the flow URL on the flow detail page.
- Pass the relevant invoice ID into a flow variable.
- Set the flow finish behavior so that when the flow [user clicks](https://answers.mindstick.com/qa/34556/if-a-user-clicks-all-the-google-ads-on-my-site-is-it-foul) Finish, the browser returns the user to the relevant invoice detail page.

**1.** Create the custom button for the Line Item custom object.

a. From Setup, click Create > Objects > Line Item.

b. In the Buttons, Links, and Actions related list, click New Button or Link.

c. Define the custom button.

Field - Value

Label - Add Line Item and Update Stock Qty

The Name is automatically populated based on this entry.

Display Type - List Button

Behavior- Display in existing window without sidebar or header

Content Source- URL

URL text box-

/flow/Add_Line_Item_from_Invoice_and_Update_Stock_Quantity

?vInvoiceId={!Invoice__c.Id}&retURL=/{!Invoice__c.Id}

![SFDC Flow:  Add a Custom Button](https://www.mindstick.com/blogs/0b1b91fe-a837-4e2b-83d4-47aaa5b3780d/images/a8ecd80b-54b9-4da2-802c-8728b46bcfa2.png)

d. Click Save.

e. Click OK.

**2.** Add the custom button to the Invoice page layout.

a. From Setup, click Create > Objects > Invoice.

b. In the Page Layouts related list, click Edit for the Invoice Layout.

c. Click ![SFDC Flow:  Add a Custom Button](https://www.mindstick.com/blogs/0b1b91fe-a837-4e2b-83d4-47aaa5b3780d/images/3f506f3c-6573-48d8-956d-4e7fc376e828.png) for the Line Items related list.

![SFDC Flow:  Add a Custom Button](https://www.mindstick.com/blogs/0b1b91fe-a837-4e2b-83d4-47aaa5b3780d/images/e99108e5-7b05-4eeb-a400-55096bec5458.png)

d. Expand the Buttons section.

e. Under Available Buttons, select Add Line Item and Update Stock Qty.

f. Click ![SFDC Flow:  Add a Custom Button](https://www.mindstick.com/blogs/0b1b91fe-a837-4e2b-83d4-47aaa5b3780d/images/6bdb6cc8-1e23-466b-8daa-07d609d30566.png).

The button name now appears under Selected Buttons.

![SFDC Flow:  Add a Custom Button](https://www.mindstick.com/blogs/0b1b91fe-a837-4e2b-83d4-47aaa5b3780d/images/b879660c-1457-4d4d-b00e-b8bcee4b841b.png)

g. Click OK.

\

**3.** Verify that the button appears in the preview area for the Line Items related list.

![SFDC Flow:  Add a Custom Button](https://www.mindstick.com/blogs/0b1b91fe-a837-4e2b-83d4-47aaa5b3780d/images/d7b9831d-8ab8-40ca-b073-4307c1323d7c.png)

**4.** Click Save.

#### Try Out the App

\

Now try out the revised app and see the flow in action.

1. To make sure you get real results when you try the app, [configure](https://answers.mindstick.com/qa/51511/how-to-configure-client-and-repository-in-informatica-power-center) an existing Merchandise record to have a known [starting](https://www.mindstick.com/blog/12024/things-you-need-to-know-when-starting-your-own-business) quantity.

a. Click the Merchandise tab.

b. Click Desktop.

c. Click Edit.

d. Set the Quantity to 1000.

e. Click Save.

Now when we try out the flow, we can easily verify that the merchandise quantity is updated correctly.

2. Click the Invoices tab and either create a new invoice or edit an [existing one](https://www.mindstick.com/interview/34109/how-do-you-generate-a-unique-file-name-to-avoid-overwriting-an-existing-one).

3. Click the Add Line Item and Update Stock Qty custom button you just created.

4. To see results on the invoice detail page, enter the following values for the line item.

Field Value

Line Item Number 11

Merchandise Desktop

Quantity Ordered 100

Unit Price 1000

5. Click Next and then Finish.

6. Verify that the line item correctly appears on the invoice detail page.

![SFDC Flow:  Add a Custom Button](https://www.mindstick.com/blogs/0b1b91fe-a837-4e2b-83d4-47aaa5b3780d/images/8af5e8a9-dec7-4266-af71-f3415e882347.png)

7. Click the Merchandise tab.

8. Click Desktop.

9. Verify that the Quantity changed from 1000 to 900

![SFDC Flow:  Add a Custom Button](https://www.mindstick.com/blogs/0b1b91fe-a837-4e2b-83d4-47aaa5b3780d/images/045c90db-a1e7-42c1-b5d5-1c07e9015ebb.png)

Congratulations! You’ve successfully updated your inventory. But what [happens if](https://www.mindstick.com/forum/159800/what-happens-if-the-ldf-file-grows-too-large) an error occurs? The [standard](https://www.mindstick.com/articles/23223/naming-convention-or-coding-standard) behavior is for the flow to email the [organization](https://answers.mindstick.com/qa/100623/what-is-the-role-of-the-world-health-organization-in-global-health) administrator a generic message, but you can modify the flow to also immediately notify the user. This is covered in my next post.

**This [document](https://www.mindstick.com/articles/328642/what-to-consider-while-choosing-a-software-documentation-tool) is referred from [salesforce help tutorials](http://www.salesforce.com/us/developer/docs/workbook/index.htm)

---

Original Source: https://www.mindstick.com/blog/10852/sfdc-flow-add-a-custom-button

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
