---
schema_version: "1"
id: fec5130866ed30d1f30907896c3cc1d29bc8ff5569630d1759c9aea451b7021a
title: Write Off Invoices by Using Invocable Action in Flow
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/billing_write_off_invoices_invoke_action.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.billing_write_off_invoices_invoke_action.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 2566b20bff2871b1a8798e8b54f6932c043a0c80dcdb50b6a4ccdf3eb0237ac2
description: Invoke the Write Off Invoices action in a flow to write off invoices.
products:
  - Revenue Cloud
release: "264"
---
# Write Off Invoices by Using Invocable Action in Flow

Invoke the Write Off Invoices action in a flow to write off invoices.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions with <a href="https://help.salesforce.com/s/articleView?id=ind.revenue_licenses_areas_and_features.htm&amp;release=264.0.0&amp;type=5">the Revenue Cloud Billing license</a>. Contact your Salesforce account executive for more information.</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d169724e74">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d169724e74 ">To write off invoices by using invocable action:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d169724e74 ">
              <p>Billing Operations User permission set</p>
              <p>Or</p>
              <p style="margin-bottom:0;">Credit Memo Operations User
                permission set</p>
            </td>

          </tr>
        </tbody>
      </table>

Before you use the write-off process, go to the Object Manager and [add all the required values to the Reason Code picklist field](https://help.salesforce.com/s/articleView?id=platform.fields_picklist_add_values.htm&language=en_US&type=5) on the Credit Memo object. Add values such as BD for bad debt charges.

[Create a screen flow](https://help.salesforce.com/s/articleView?id=platform.flow_distribute_internal_action.htm&language=en_US), define the these variables to use as the input and output for the action.

1. Create WriteOffInvoiceInputList resource.
    1. Select Variable as the resource type.
    2. Enter WriteOffInvoiceInputList as the API name.
    3. Select Apex-defined as the data type.
    4. Select InvoiceWriteOff\_\_WriteOffInvoiceInputList as the apex class.
2. Create WriteOffInvoiceInput resource.
    
    1. Select Variable as the resource type.
    2. Enter WriteOffInvoiceInput as the API name.
    3. Select Apex-defined as the data type.
    4. Select InvoiceWriteOff\_\_WriteOffInvoiceInput as the apex class.
    
    You can create multiple input resources as required.
3. Specify invoiceId, reasonCode, and reason as the API names for the input variables of text data type.
    
    reasonCode is a required value but reason is optional.
4. Add an Assignment element and assign the text data type variables as values to the Apex-defined data type variables of the WriteOffInvoiceInput resource.
    
    ![Write off input](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-revenue-264-0-0-production-enus/91ca99c6-d5c8-4986-b961-c6b7801e0d0d/revenue/images/billing/billing_write_off_ia_input.png)
5. Add an Assignment element and add WriteOffInvoiceInput resource to WriteOffInvoiceInputList.
    
    If you have created multiple WriteOffInvoiceInputs, click Add Assignment and add them all to the WriteOffInvoiceInputList in the same element.
    
    ![Write off input list](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-revenue-264-0-0-production-enus/91ca99c6-d5c8-4986-b961-c6b7801e0d0d/revenue/images/billing/billing_write_off_ia_input_list.png)
6. Repeat the steps to create WriteOffInvoiceResponse and WriteOffInvoiceResponseList resources and assign WriteOffInvoiceResponse to WriteOffInvoiceResponseList resource.
    
    Alternatively, you can also create a Loop element for WriteOffInvoiceResponseList resource.
7. Add an Action element, find and select writeOffInvoices-writeOffInvoices action.
    
    1. Select the writeOffInvoiceInputList input value as the writeOffInvoiceInputList.
    2. Select the writeOffInvoiceResponseList output value as the writeOffInvoiceResponseList.
    
    ![Write off invocable action](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-revenue-264-0-0-production-enus/91ca99c6-d5c8-4986-b961-c6b7801e0d0d/revenue/images/billing/billing_write_off_ia.png)
8. Activate the flow.

After activating the flow, [create and add a quick action](https://help.salesforce.com/s/articleView?id=platform.flow_distribute_internal_action.htm&language=en_US) to the invoice page layout and use the invocable action.