Invoices: Overview of Methods

An invoice is the final stage of a deal. It is created when all discussions are complete and the terms of the agreement are agreed upon. Multiple invoices can be created for different products and services within a single deal.

An invoice can be generated from a template and sent to the client as a document. In the invoice detail form, you can:

  • Manage the sales process of a product or service
  • Track the stages of working with the invoice
  • Accept online payments

Quick navigation: all methods and events

User documentation: New invoices in CRM

Linking Invoices with Other CRM Objects

Deal. Pass the deal ID in the parentId2 parameter to link the new invoice with the deal.

Estimate. Pass the estimate ID in the parentId7 parameter to link the new invoice with the estimate.

Client. This field in the invoice detail form consists of the associated company and contacts. All activities related to calls, e-mails, and chats with the contact or company will be saved in the invoice detail form. There can be one company in the field, and it is referenced through the invoice field companyId. Multiple contacts can be specified, and interactions with them are managed through the contactIds field; pass an array of contact IDs in this field.

Products. Adding, modifying, and deleting product items in invoices can be done through the group of methods crm.item.productrow.*.

Payments. Adding, modifying, and deleting payment documents in invoices can be done through the group of methods crm.item.payment.*.

Your Company Details. Specify your company ID in the mycompanyId field so that its details are automatically used in documents. You can obtain your company ID using the method crm.item.list for the companies object with a filter on the isMyCompany field.

BX24.callMethod(
                'crm.item.list',
                {
                    entityTypeId: 4,
                    filter: {
                        "isMyCompany": "Y",
                    },
                },
                (result) => {
                    if (result.error())
                    {
                        console.error(result.error());
                        return;
                    }
                    console.info(result.data());
                },
            );
        

Invoice Detail Form

The main workspace in invoices is the General tab of the detail form. It consists of two parts:

  • The left part contains fields with information. If the system fields are insufficient, you can create your own custom fields. They allow you to store information in various data formats: string, number, link, address, and others. To create, modify, retrieve, or delete custom fields for invoices, use the group of methods userfieldconfig.*.

  • The right part contains the invoice timeline. In it, you can create, edit, filter, and delete CRM activities — the group of methods crm.activity.*, and timeline records — the group of methods crm.timeline.*.

The parameters of the invoice detail form can be managed through the group of methods crm.item.details.configuration.*.

Widgets

You can embed an application into the invoice detail form. This allows you to use the application without leaving the invoice detail form.

There are two embedding scenarios:

Embedding Locations for New Invoices

Overview of Methods and Events

Scope: crm

Who can execute the method: depending on the method

Main

CRM Object Identifier entityTypeId31

crm.item.add

Creates a new CRM entity

crm.item.update

Updates an entity

crm.item.get

Returns an entity by Id

crm.item.list

Returns a list of entities by filter

crm.item.delete

Deletes an entity

crm.item.fields

Returns the fields of an entity

onCrmDynamicItemAdd

When a custom type CRM object is created

onCrmDynamicItemDelete

When a custom type CRM object is deleted

onCrmDynamicItemUpdate

When a custom type CRM object is modified

Custom Fields

CRM Object Identifier entityIdCRM_SMART_INVOICE

Method

Description

userfieldconfig.add

Creates a custom field

userfieldconfig.update

Modifies field settings

userfieldconfig.get

Returns the settings of a custom field by identifier

userfieldconfig.getTypes

Returns the set of available types of custom fields for the module

userfieldconfig.list

Returns a list of custom field settings

userfieldconfig.delete

Deletes a custom field

Product Items

CRM Object Identifier ownerTypeSI

Method

Description

crm.item.productrow.add

Adds a product item

crm.item.productrow.update

Updates a product item

crm.item.productrow.get

Retrieves information about a product item by id

crm.item.productrow.set

Associates a product item with a CRM object

crm.item.productrow.list

Retrieves a list of product items

crm.item.productrow.getAvailableForPayment

Retrieves a list of unpaid products

crm.item.productrow.delete

Deletes a product item

crm.item.productrow.fields

Retrieves a list of product item fields

Payments

CRM Object Identifier entityTypeId31

Method

Description

crm.item.payment.add

Creates a payment for a CRM object

crm.item.payment.update

Modifies the set of payment fields

crm.item.payment.get

Retrieves brief information about a payment

crm.item.payment.list

Retrieves a list of payments for a specific CRM object

crm.item.payment.delete

Deletes a payment

crm.item.payment.pay

Changes the payment status to "Paid"

crm.item.payment.unpay

Changes the payment status to "Unpaid"

Product Items in Payment

Method

Description

crm.item.payment.product.add

Adds a product item to the payment

crm.item.payment.product.list

Retrieves a list of product items in the payment

crm.item.payment.product.delete

Deletes a product item from the payment

crm.item.payment.product.setQuantity

Changes the quantity of a product in the payment item

Delivery in Payment

Method

Description

crm.item.payment.delivery.add

Adds a delivery item to the payment

crm.item.payment.delivery.list

Retrieves a list of delivery items for a specific payment

crm.item.payment.delivery.delete

Deletes a delivery item from the payment

crm.item.payment.delivery.setDelivery

Reassociates the delivery item with another delivery document

Managing Invoice Detail Form Settings

CRM Object Identifier entityTypeId31

crm.item.details.configuration.forceCommonScopeForAll

Sets a common detail form for all users

crm.item.details.configuration.get

Retrieves the parameters of the detail form for entities

crm.item.details.configuration.reset

Resets the parameters of the detail form for entities

crm.item.details.configuration.set

Sets the parameters of the detail form for entities