CRM0111 Create Service agreements
Basic Information
Module | Crm.Sales |
---|---|
Code | CRM0111 |
Parent Document | Sales Order |
Sub-document | Service Аgreement |
Full Name | Create Service agreements |
Status | NEW |
Deterministic | YES |
Supports Transitional Documents | NO |
Supports Single Execution | YES |
Replaces | GenerateServiceAgreement |
Orphan Rows | Ignore |
Introduced In Version | |
Date of Suspension | - |
Business Logic
This generation creates Service Agreements only for the products from the current Sale Order that are serviced (Product.ProductType.IsServiced = True), but are not stocked (Product.ProductType.IsStocked = False). A new Service object is created for each of these products and it is saved in the Service Agreement Lines.
The generation is used to create Service Agreements only for products that are not stocked. For the other serviced products is used the respective generation from the Store Transactions (which are the result of this Sales Order).
The generation works only if there is a service type that is marked as default. Otherwise, it throws an error for missing default service type.
Also, the generation works only if the field Guarantee Period Days has a value. Otherwise, it throws an error for the missing values.
Metrics
No metrics are used by this generation. A new sub-document is created each time the generation starts, regardless of the sub-documents that have already have been created.
The Service Agreement header is created from the Sales Order header as follows:
ServiceAgreement.Customer = SalesOrder.Customer
ServiceAgreement.StartDateTime = Today
For each Sales Order Line, which contains a product that is defined as serviced and is not stocked, are created:
a new service object as follows:
ServiceObject.Product = SalesOrderLine.Product
ServiceObject.SerialNumber = SalesOrderLine.SerialNumber
ServiceObject.ServiceObjectName = SalesOrderLine.Product.ProductName
ServiceObject.Notes = SalesOrder.DisplayText
ServiceObject.EnterpriseCompany = ServiceAgreement.EnterpriseCompany
and a new Service Agreement Line as follows:
ServiceAgreementLine.LineNo = SalesOrderLine.LineNo
ServiceAgreementLine.ServiceObject = the new ServiceObject, created by this generation
ServiceAgreementLine.Quantity = SalesOrderLine.Quantity
ServiceAgreementLine.LineStartDateTime = Today
ServiceAgreementLine.LineEndDateTime = Today + SalesOrderLine.GuaranteePeriodDays
ServiceAgreementLine.ServiceType = the ServiceType which is marked as default
ServiceAgreementLine.ParenDocument = SalesOrder
ServiceAgreementLine.ParentLineNo = SalesOrderLine.LineNo
Note
The created service agreement is saved only if there is at least one line in it.