R28659 SalesOrder - Generate Deal

Code R28659
Entity Crm.Sales.SalesOrders Entity
Name GenerateDeal
Attribute Deal
Layer Back-End
Events Releasing +
Priority Normal
Modify YES
Action Validate that:

if (SalesOrder.oldState < 30 && SalesOrder.newState >=30 && SalesOrder.Deal == null && SalesOrder.DocumentType.OfferOption.DealDocumentType != null)

(

new Deal is created as follows:

Deal.DocumentType = DealDocumentType

Deal.Notes = SalesOrder.Notes

Deal.Party = SalesOrder.Customer.Party

Deal.LeadingSalesPerson = SalesOrder.SalesPerson

Deal.ExpectedRevenue = Sum(SalesOrderLines.LineAmount) + Sum(DocumentAmounts[AddToLine == true].Amount)

Deal.ExpectedRevenueCurrency = SalesOrder.DocumentCurrency

Deal.RevenueStartDate = SalesOrder.DocumentDate

Deal.RevenueEndDate = SalesOrder.DocumentDate

Deal.SuccessProbability = 1

Deal.DealStatus = Successful

Deal.Dealer = SalesOrder.Dealer

)

&&

(

SalesOrder.Deal == Deal //the newly created Deal

SalesOrder.PrimeCauseDocument = Deal

)
Description The current business rule give the user an option to automatically create deal for the current SalesOrder, if none is created by now. This keeps the data consistency when the company has model where salesman work on deals and create SalesOrders based on those deals.

If for some reason there is an SalesOrder with no deal, such is automatically created.
Message Problem occurred while automatically creating deal for the current Sales Order. The Sales Person attribute must have a value.
Introduced In Version 2018.2
Revocable NO

* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.