> For the complete documentation index, see [llms.txt](https://docs.fieldmotion.com/fieldmotion-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fieldmotion.com/fieldmotion-api-docs/target/_getname.md).

# \_getName

Fetches the Target that is linked to a PurchaseOrder or RequisitionOrder.

### Parameters

#### id

The ID of the Target.

#### type

The type of the Target. It is an integer from 1-6, which corresponds to one of the following types:

1. Contract
2. Customer
3. Quote
4. Appointment
5. Department
6. Location

### Example

This example fetches a link to a Contract:

```
FM_api('Target_getName', ['id' => '123', 'type' => '1']);
```

### Result

#### On Success

The name of the Target as a string. For example:

```
"Contract 123"
```

#### On Failure

If the User is not logged in:

```
{'error':'not logged in'}
```

If there is no ID provided:

```
{'error':'no target ID provided'}
```

If there is no type provided:

```
{'error':'no target type provided'}
```
