Writing a business rule that would work correctly when adding or modifying records in the editable list

Question

How should I write a business rule that would work correctly when adding or modifying records in the editable list? When configuring a list column, I need to use columns of the connected objects.

Answer

In case of connected objects, we recommend using the attribute and attributePath properties in business rules:

"attribute": "Order",
"attributePath":"SxPaymentFormula.SxPaymentDelay"

In case of the editable list, this variant is not always a good option, since one half of the logic is executed in the page, while the other half is executed in the list. In this case, the simplest solution would be setting the attribute value in the initEntity method of the detail page. See below:

initEntity: function(callback, scope) {
        this.callParent([function() {
                if (!this.get("Order.SxPaymentFormula.SxPaymentDelay")) {
                        this.set("Order.SxPaymentFormula.SxPaymentDelay",
                                this.get("Order") && this.get("Order")["SxPaymentFormula.SxPaymentDelay"]);
                }
                callback.call(scope || this);
        }, this]);
}

In the business rule, in this case, use only the below:

"attribute": "Order.SxPaymentFormula.SxPaymentDelay"

 

Like 0

Like

Share

0 comments
Show all comments