top of page

Majoration

Introduction

i want a markup according to a product option, how to manage it?

Custom field





Price rule



Price action


Custom script


export function   onAfterCalculate(_quoteModel,QuoteLines){
if(QuoteLines!=null){
var customerPrice=0
var netPrice=0
var priceTotal=0
var MarkupProduct1= false
var QuantityProduct2=0
QuoteLines.forEach(async line => {
var parent= line.parentItem
if(parent !=null ){
if(line.record.SBQQ__ProductCode__c ==   'Markup1'){
MarkupProduct1=true
}
if(line.record.SBQQ__ProductCode__c=='Markup2'){
QuantityProduct2=line.record.SBQQ__Quantity__c
}
}

customerPrice=   line.record.SBQQ__CustomerPrice__c == 0 ? 0 :   line.record.SBQQ__CustomerPrice__c

netPrice=customerPrice*(1+(parent.record["markupCustom__c"]/100))
line.record.SBQQ__NetPrice__c=netPrice
priceTotal+=line.record.SBQQ__NetPrice__c*line.record.SBQQ__Quantity__c

if(MarkupProduct1){
if(QuantityProduct2>5){
priceTotal+=50
MarkupProduct1=false
}
else{
priceTotal+=25
MarkupProduct1=false
}
}
parent.record["CSTotal__c"]=priceTotal
});
}
return Promise.resolve();
}

Upgrade time

In the price rule, you need to automate the markup field (in our case, if the markup is already filled, they can’t change)

Result


0 views0 comments

Recent Posts

See All

Commentaires

Noté 0 étoile sur 5.
Pas encore de note

Ajouter une note
bottom of page