R31508-27 Purchase Invoice Line - Apply Required Custom Properties
Code | 31508-27 |
Entity | Logistics.Procurement.PurchaseInvoiceLines Entity |
Name | ApplyRequiredCustomProperties |
Attribute | CustomProperties |
Layer | Front-End |
Events | AttributeChanged(Product) |
Priority | Normal |
Modify | YES |
Applicable Legislations | ALL // no condition needed |
Action | if (OldValue != NewValue AND OldValue.ProductType != NewValue.ProductType)
{
PurchaseInvoiceLine.RefreshCustomPropertyValues(Product);
}
*PurchaseInvoiceLine.RefreshCustomPropertyValues(Product): propertiesByProdType = Transaction.Query<ProductTypePurchaseInvoiceLineProperty>() .Where(ProductType == product.ProductType); requiredProp = propertiesByProdType.Select(Property); actualProp = CustomProperties.GetActualPropertyValues(); foreach (actualProp) { if (!requiredProp.Contains(actual property)){CustomProperties.GetPropertyValue(actual property).Delete();} } foreach (requiredProp) { currentPV = CustomProperties.GetPropertyValue(requiredProperty); if (currentPV == null) PropertyValue newPV = new PropertyValue{Property = item, EntityItemId = PurchaseInvoiceLine.Id) } |
Description | There are Custom Properties for Product Types which are required for Purchase Invoice Lines. When the Product is changed, all missing custom properties for the line according to the Product's Product Type should be added. If there are previously added Custom Properties for the line, they are deleted, except when the Product is changed to another Product with the same Product Type- any previously added Custom Properties for the line will remain unchanged. |
Message | |
Version | Introduced: 21 |
Revocable | YES |
* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.