# Delete Attachment

> `UiPath.ServiceNow.Activities.DeleteAttachment`

`UiPath.ServiceNow.Activities.DeleteAttachment`

The **Delete Attachment** activity uses the the ServiceNow [Attachment - DELETE](https://docs.servicenow.com/bundle/sandiego-application-development/page/integrate/inbound-rest/concept/c_AttachmentAPI.html#attachment-DELETE) API to delete a specific file (**ObjectSysId**).

After deleting the attachment, the activity outputs the status of the request (success/failure information) in a `ResponseStatus` object (**ServiceNowStatus**) that you can use in subsequent activities (e.g., conditional logic).

## How it works

The following steps and message sequence diagram is an example of how the activity works from design time (i.e., the activity dependencies and input/output properties) to run time.

1. Complete the [Setup](https://docs.uipath.com/activities/other/latest/legacy-integrations/servicenow-setup) steps.
2. Add the [ServiceNow Scope](https://docs.uipath.com/activities/other/latest/legacy-integrations/servicenow-scope) activity to your project.
3. Add the **Delete Attachment** activity inside the **ServiceNow Scope** activity.
4. Enter a value for the [Input](https://docs.uipath.com/activities/other/latest/legacy-integrations/servicenow-delete-attachment#delete-attachment) properties.
5. Create and enter `ResponseStatus` variable for the [Output](https://docs.uipath.com/activities/other/latest/legacy-integrations/servicenow-delete-attachment#delete-attachment) properties.
   * Your input property value is sent to the [Attachment - DELETE](https://docs.servicenow.com/bundle/sandiego-application-development/page/integrate/inbound-rest/concept/c_AttachmentAPI.html#attachment-DELETE) API.
   * The API returns the `ResponseStatus` value to your output property variable.

     ![docs image](https://dev-assets.cms.uipath.com/assets/images/activities/legacy-integrations-docs-image-183337-a4222e0f-38e85cb0.webp)

## Properties

### Common

* **DisplayName** - The display name of the activity. This field supports only `Strings` or `String` variables.

### Input

* **ObjectSysId** - The **sys_id** of the attachment you want to delete. Enter a `String` or `String` variable. To get the **sys_id** value, you can follow one of the methods shown in the ServiceNow [unique record identifier (sys_id)](https://docs.servicenow.com/bundle/sandiego-platform-administration/page/administer/table-administration/concept/c_UniqueRecordIdentifier.html) documentation or right-click on the record in the ServiceNow UI and select the **Copy sys_id** option in the pop-out menu.

### Misc

* **Private** - If selected, the values of variables and arguments are no longer logged at Verbose level.

### Output

* **AttachmentId** - The **sys_id** of the attachment. Enter a `String` a variable. The variable you create for this property can be used as an input variable in subsequent activities (e.g., [Get ServiceNow Record](https://docs.uipath.com/activities/other/latest/legacy-integrations/servicenow-get-servicenow-record), [Download Attachment](https://docs.uipath.com/activities/other/latest/legacy-integrations/servicenow-download-attachment), etc.).
* **ServiceNowStatus** - The status of the request (success/failure information). Enter a `ResponseStatus` variable (*UiPath.BAF.Models.ResponseStatus*). The `ResponseStatus` object includes three properties that you can use in other activities.
  + **Success** - `Boolean` - Specifies whether the API request was successful.
  + **ErrorCode** - `String` - The response error if the API request is unsuccessful (**Success**=*False*).
  + **Message** - `String` - The error message.

## Example

The following image shows an example of the activity dependency relationship and input/output property values.

For step-by-step instructions and examples, see the [Quickstart](https://docs.uipath.com/activities/other/latest/legacy-integrations/servicenow-quickstarts) guide.

![docs image](https://dev-assets.cms.uipath.com/assets/images/activities/legacy-integrations-docs-image-183429-997f2505-c1bf0b43.webp)
