top of page
Houssem Jemli

Prorata

Introduction

I want to disable the prorate for a product. How to do it?



Field you need:

In quote line



CS


// This   function is called on initialization. It's responsible for starting the   process of modifying quote line models.
export function onInit(quoteLineModels) {
    // Call DisableProrata function with   quoteLineModels as argument.
    // This modular approach separates   concerns and improves code readability.
    DisableProrata(quoteLineModels);

    // Return a resolved Promise,   indicating the completion of this initialization phase.
    return Promise.resolve();
};

// This   function handles the specific task of disabling proration based on certain   conditions in each quote line model.
function DisableProrata(quoteLineModels){
    // Check for an empty or undefined   quoteLineModels argument.
    // If found, immediately return a   resolved Promise as there's nothing to process.
    if (!quoteLineModels || quoteLineModels.length === 0) {
        return Promise.resolve();
    }

    // Iterate over each quote line model   to apply specific logic.
    quoteLineModels.forEach(line => {
        // Check if 'record'   exists and if 'DisableProration__c' is true.
        // If so, set the   'calculateFullTermPrice' property to true.
        // This indicates   that full term pricing should be calculated for this line.
        if (line.record   && line.record["DisableProration__c"]) {
            line.calculateFullTermPrice = true;
        }
    });
}

Conclusion

If you want automate this, add a twin field with product.

Result


1 view0 comments

Recent Posts

See All

Campaign

Коментари

Оценено с 0 от 5 звезди.
Все още няма оценки

Добавяне на отзив
bottom of page