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());
},
);
User Documentation
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.*.
User Documentation
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:
- Use special embedding locations. For example, by creating your own tab.
- Create a custom field where the interface of your application will be loaded.
Embedding Locations for New Invoices
-
CRM_SMART_INVOICE_DETAIL_TAB— a tab in the detailed view of the CRM entity -
CRM_SMART_INVOICE_DETAIL_ACTIVITY— a button above the timeline of the detail form -
CRM_SMART_INVOICE_DETAIL_TOOLBAR— an item in the dropdown menu of the top button in the detail form -
CRM_SMART_INVOICE_DOCUMENTGENERATOR_BUTTON— an item in the dropdown menu of the document generator -
CRM_SMART_INVOICE_LIST_MENU— an item in the context menu in the list of entities -
CRM_SMART_INVOICE_LIST_TOOLBAR— an item in the dropdown menu above the list of entities -
CRM_SMART_INVOICE_TIMELINE_MENU— an item in the context menu of an activity in the detail form -
CRM_SMART_INVOICE_ROBOT_DESIGNER_TOOLBAR— an item in the dropdown menu of the top button of the robot designer
Typical use-cases and scenarios
Overview of Methods and Events
Scope:
crmWho can execute the method: depending on the method
Main
CRM Object Identifier entityTypeId — 31
|
Creates a new CRM entity |
|
|
Updates an entity |
|
|
Returns an entity by Id |
|
|
Returns a list of entities by filter |
|
|
Deletes an entity |
|
|
Returns the fields of an entity |
|
When a custom type CRM object is created |
|
|
When a custom type CRM object is deleted |
|
|
When a custom type CRM object is modified |
Custom Fields
CRM Object Identifier entityId — CRM_SMART_INVOICE
|
Method |
Description |
|
Creates a custom field |
|
|
Modifies field settings |
|
|
Returns the settings of a custom field by identifier |
|
|
Returns the set of available types of custom fields for the module |
|
|
Returns a list of custom field settings |
|
|
Deletes a custom field |
Product Items
CRM Object Identifier ownerType — SI
|
Method |
Description |
|
Adds a product item |
|
|
Updates a product item |
|
|
Retrieves information about a product item by id |
|
|
Associates a product item with a CRM object |
|
|
Retrieves a list of product items |
|
|
Retrieves a list of unpaid products |
|
|
Deletes a product item |
|
|
Retrieves a list of product item fields |
Payments
CRM Object Identifier entityTypeId — 31
|
Method |
Description |
|
Creates a payment for a CRM object |
|
|
Modifies the set of payment fields |
|
|
Retrieves brief information about a payment |
|
|
Retrieves a list of payments for a specific CRM object |
|
|
Deletes a payment |
|
|
Changes the payment status to "Paid" |
|
|
Changes the payment status to "Unpaid" |
Product Items in Payment
|
Method |
Description |
|
Adds a product item to the payment |
|
|
Retrieves a list of product items in the payment |
|
|
Deletes a product item from the payment |
|
|
Changes the quantity of a product in the payment item |
Delivery in Payment
|
Method |
Description |
|
Adds a delivery item to the payment |
|
|
Retrieves a list of delivery items for a specific payment |
|
|
Deletes a delivery item from the payment |
|
|
Reassociates the delivery item with another delivery document |
Managing Invoice Detail Form Settings
CRM Object Identifier entityTypeId — 31
|
Sets a common detail form for all users |
|
|
Retrieves the parameters of the detail form for entities |
|
|
Resets the parameters of the detail form for entities |
|
|
Sets the parameters of the detail form for entities |