Skip to main content

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?

2 个回答
  1. 8月12日 10:57

    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: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.

     

    When you will write your own CML please make sure it is not slow.

0/9000