function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sagar077sagar077 

Hi Everyone, I need to Pullout the Standard Price Book value from the Product Object to Quote Line object (and want to store it in the custom field) by using customization in CPQ. Thanks in Advance

Hi Everyone,

I need to Pullout the Standard Price Book value from the Product Object to Quote Line object (and want to store it in the custom field) by using customization in CPQ.

Thanks in Advance
AnudeepAnudeep (Salesforce Developers) 
I recommend looking at the below sample code

Populate standard price product value from Standard Price Book to another custom object/field
 
trigger PopulateStandardPrice2 on Product2 (before insert,before update,after insert,after update) {
    list<Id> Idlist = new list<Id>();
    list<product2> ProdsToUpdate = new list<Product2>();
    for(Product2 pr:trigger.new){
        Idlist.add(pr.Id);
    }
    pricebook2 pb = [select Id from pricebook2 where IsStandard = TRUE][0];
    Id stPrId = pb.Id;
    for(product2 p:[select Product_Price_Unit__c,Id from product2 where Id IN :Idlist]){
        for(pricebookentry pbe:[select Product2Id,UnitPrice from pricebookentry where pricebook2Id = :stPrId and product2Id IN :Idlist]){
            If((pbe.Product2Id == p.Id)&&(p.Product_Price_Unit__c!=pbe.UnitPrice)){
                p.Product_Price_Unit__c = pbe.UnitPrice;
                system.debug('this is it '+pbe.UnitPrice);
                system.debug('this is that '+p.Product_Price_Unit__c);
                ProdsToUpdate.add(p);
            }
        }
    }
    If(ProdsToUpdate.size()>0&&trigger.isafter){
            update ProdsToUpdate;
    }
}

NOTE: The code provided is an example. You'll need to review and make modifications for your organization.

Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you