I have a scenario when the Product A added to the quote and i try to add any other product then i should have a error. Also if i have added other products then i should not be allowed to add a Product A. Can this be done just with RCA configurations or CML?
The question is likely no longer relevant, but here is a possible solution for anyone who might encounter this in the future.
In the example bellow Product A is a Laptop.
CML:
type LineItem;
type Laptop : LineItem;
type Desktop : LineItem;
type Printer : LineItem;
@(virtual = true)
type Quote {
@(sourceContextNode = "SalesTransaction.SalesTransactionItem")
relation lines : LineItem[0..200];
constraint(lines[Laptop] == 0 || lines[LineItem] == lines[Laptop], "Laptop must be quoted on its own. Remove the other products, or remove the Laptop.");
}
Result:
When you will write your own CML please make sure it is not slow.