Loading
Upcoming Mandatory Changes to Public Key Infrastructure (PKI)Read More
Salesforce Enforces New Security Requirements in Summer 2026Read More
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Write Off Invoices by Using Invocable Action in Flow

          Write Off Invoices by Using Invocable Action in Flow

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

          Required Editions

          Available in: Lightning Experience
          Available in: Enterprise, Unlimited, and Developer Editions with the Revenue Cloud Billing license. Contact your Salesforce account executive for more information.
          User Permissions Needed
          To write off invoices by using invocable action:

          Billing Operations User permission set

          Or

          Credit Memo Operations User permission set

          Before you use the write-off process, go to the Object Manager and add all the required values to the Reason Code picklist field on the Credit Memo object. Add values such as BD for bad debt charges.

          Create a screen flow, 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
          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
          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
          8. Activate the flow.

          After activating the flow, create and add a quick action to the invoice page layout and use the invocable action.

           
          Loading
          Salesforce Help | Article