This page is for admins who make Buttons.

In this guide, you make a Link button that opens the invoice activity of a customer in
[Xero](https://www.xero.com/). The URL uses the Xero ID of the customer.

You need an organization field that contains the Xero contact ID of the customer, for example a custom field
**Xero ID**. An integration fills in this field, for example a Make scenario or a Zap that makes the customer in Xero.
For Xero in these tools, see the help of [Make](https://www.make.com/en/help/app/xero) and
[Zapier](https://help.zapier.com/hc/en-us/articles/38844152391821-How-to-get-started-with-Xero-on-Zapier).

## Get a sample URL

1. Open Xero.
2. Open the contacts and select a customer. Xero shows the activity of the customer.
3. Copy the URL from the address bar of the browser.

The URL is long. Keep the part to `/activity/` and delete the rest:

```
https://go.xero.com/app/!wz58Q/contacts/contact/d79ce333-a1a4-41fa-996e-5c09e9032f3d/activity/
```

The part after `/app/`, here `!wz58Q`, identifies your Xero organization. Your URL has a different value. The part
between `contact/` and `/activity/` is the Xero ID of the customer. The Link button puts the Xero ID of the
organization in its place.

## Make the Link button

1. Open a deal or an organization in Pipedrive.
2. Make a Link button and type the **Button text**, for example `Show invoices in Xero`. See
   [Make a Link button](/docs/buttons/link-button#make-a-link-button).
3. Click **Dynamic URL** in the menu.
4. Paste the sample URL into the first text element.
5. Delete the Xero ID of the sample customer. Keep the slashes at the two sides of it.
6. Click in the text at the position of the deleted ID.
7. Click **Split** in the URL toolbox. The text divides into two elements. The right element contains `/activity/`.
8. Put the pointer on the left element and click **Add dynamic field**. A field element shows between the two text
   elements.
9. Click the **Organization** tab of the field picker.
10. Type the name of your Xero ID field in **Search by name or key**, and click the field.
11. Click **Save**.

![The Dynamic URL section of the Link button Show invoices in Xero: the Xero URL, the organization field Xero ID and the text /activity/](https://res.cloudinary.com/zimple/image/upload/f_auto,q_auto/oneclick-docs/using-oneclick-with/xero/show-invoices-in-xero/dynamic-url.png)

For the URL toolbox and the field picker, see [Dynamic URL](/docs/buttons/link-button#dynamic-url).

## Show the Button only where it applies

On an organization, OneClick reads the Xero ID of that organization. On a deal, it reads the Xero ID of the
organization of the deal. On a person, the URL has no value. See
[Fields and the record of the click](/docs/buttons/link-button#fields-and-the-record-of-the-click).

1. Turn on the switch of **Limit Visibility** and click **Limit Visibility**.
2. In **Show only in scopes**, select organization. To show the Button on deals too, also select deal.
3. Click **Save**.

![The Limit Visibility section of the Link button Show invoices in Xero with the scopes organization and deal](https://res.cloudinary.com/zimple/image/upload/f_auto,q_auto/oneclick-docs/using-oneclick-with/xero/show-invoices-in-xero/limit-visibility.png)

See [Limit visibility](/docs/buttons/limit-visibility).

## Test the Button

1. Open an organization that has a value in the Xero ID field.
2. Click the Button in the OneClick Panel. Xero opens the activity of the customer.

![The OneClick Panel of the organization Acme Robotics Ltd with the Button Show invoices in Xero](https://res.cloudinary.com/zimple/image/upload/f_auto,q_auto/oneclick-docs/using-oneclick-with/xero/show-invoices-in-xero/panel-on-organization.png)

If the Xero ID field is empty, OneClick does not open the URL. The Panel shows an error in place of the Button.

## Open one invoice from a deal

You can use the same steps to open one invoice from a deal. You then need a deal field that contains the Xero ID of
the invoice, for example a custom field **Xero invoice ID**.

1. Open the invoice in Xero and copy the URL from the address bar.
2. Make a Link button. In the **Dynamic URL**, replace the ID of the invoice with the invoice field from the **Deal**
   tab of the field picker.
3. In **Show only in scopes**, select deal.
