Question

Creating own discount amount formula for product page

Hi team,

Iam trying to over write the discount amount calculation field formula.

any suggestions?

 

regards,

sethuraghav N

Like 0

Like

5 comments

Hello,

You can create a business process which will enter a discount field automatically accordingly to your formula (https://academy.bpmonline.com/documents/technic-bpms/7-13/business-process-use-cases?document=studio). Or you can search in schemas how default calculation of a discount is made and use it as an instance.

Beat regards,

Anastasiia

Anastasia Polo,

Thanks for replying .For editable list in product in order if we we are writing an own method . what is the mode of triggering because on initialised() and on save wont work in editiable list to my knowledge. kindly correct me if iam wrong 

sethuraghav,

Indeed, there is no onEntityInitialized method on detail with editable grid. Please try another approach for triggering custom method on page changes.

Add an attribute, which will indicate the columns and method to be triggered by this columns change. For example:

        attributes: {            
            "Quantity": {
                dependencies: [
                    {
                        columns: ["Quantity"],
                        methodName: "calculateBalance"
                    }
                ]
            }
        },
 
        methods: {
            calculateBalance: function() {
                var param1 = this.get("Quantity");
                console.log(param1);
            }
        },

Add your functionality to the detail page schema.

Regards,

Anastasia

Hi,

I tried this approach and didn't worked. Anastasia, can you send complete snipped?

Yosue Rodriguez,

The code snippet is complete for the approach: you add an attribute to listen for changes on the page and trigger custom method. Please make sure, that you have added the code to the detail page. Even though you are not using the page when switching to editable grid, but the page is still responsible for the logic of its fields.

Regards,

Anastasia

Show all comments