Giter VIP home page Giter VIP logo

cpq-js's People

Contributors

sseixas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cpq-js's Issues

Reconfiguring existing bundle on amendment quote

I am trying to reconfigure an existing bundle on amendment quote - I can update the quantity of existing options under that bundle using read quote api and then doing loop on qli array but if i need to add new option under same bundle product , i am not able to do that. When i try to use addproduct api - it adds same bundle product twice which should not happen.

I am not able to find which method to reconfigure this via api.

Did SB API make changes? Calculate not seeming to update prices.

@sseixas - this is a support question and I apologize in advance. I have not been able to communicate with anyone that has successfully interacted with the public API in the past successfully and I am hoping you can point me in the right direction or confirm that the api behavior changed from how it worked in the past.

I am noticing that calling cpqjs.quote.calculate(quoteModel) (or invoking directly from API using apex) does not update all pricing on the quote lines. I added a line using productAdder and the calculation is not setting any pricing regardless of the calculate flag or if I call calculate() on it at a later point.

If I open the QLE I can click calculate and it works just fine.

Are you aware of any changes to the API or, if you have time, can you confirm if you get the same behavior? I can see that my price rules are fired (because I have a sample callout as a POC that shows in the log), but the returned quote model does not have any pricing set. I have confirmed this in multiple orgs.

These fields don't get set when I run calculate or add a product

SBQQ__CustomerPrice__c
SBQQ__NetPrice__c
SBQQ__PartnerPrice__c
SBQQ__ProrateMultiplier__c
SBQQ__ProratedListPrice__c
SBQQ__ProratedPrice__c
SBQQ__RegularPrice__c
SBQQ__SpecialPrice__c
SBQQ__UpliftAmount__c

Using this library, here is my code - it processes successfully, but pricing does not update on calculate.

const oauth2 = {
    url: 'https://na59.salesforce.com',
    refreshToken: 'foo'
};
const cpqjs = require('cpq-js')(oauth2);

const quoteId = 'a0nf4000001Li62';

cpqjs.quote.read(quoteId)
.then(quoteModel => {
    console.log('Read initial quote', quoteModel);
    // cpqjs.quote.calculate(quoteModel)
    addProduct(quoteModel) // Add product (and calculate at the same time)
    .then((calculatedQuote) => {
        console.log('Add/calculate done', calculatedQuote);
        cpqjs.quote.save(calculatedQuote)
        .then(function(savedQuote) {
            console.log('Saved Quote! :)');
            process.exit(0);
        })
        .catch(err => {
            console.log('ERROR saving quote', err);
        });
    })
    .catch(err => {
        console.log('ERROR calculating quote', err);
    });
})
.catch(err => {
    console.log('ERROR reading quote', err);
});


function addProduct(quote) {
    return new Promise((resolve, reject) => {
        // cpqjs.product.read(productId, pricebookId, currencyCode, version)
        cpqjs.product.read('01tf40000004prdAAA', '01sf4000001wmysAAA', 'USD')
        .then(productModel => {
            const groupKey = 1; // the index of the quote group you want to add the products to
            const products = [productModel]; // the array of product objects to add to the quote (from cpqjs.product.read)
            const ignoreCalculate = false; // if true does not perform a quote calculation after adding the products
            cpqjs.quote.addProducts(quote, groupKey, products, ignoreCalculate)
            .then((quoteWithAddedProducts) => {
                console.log('Added product to quote');
                resolve(quoteWithAddedProducts);
            })
            .catch(err => {
                console.log('ERROR adding products', err);
                reject(err);
            });
        })
        .catch(err => {
            console.log('ERROR reading product', err);
            reject(err);
        });

    });
}

Quote line after:
image

Error while running gulp build command

Hi Scott,

getting below error when I run gulp build command.

appreciate any help? Thanks,

LNGHBEM-M4L577TC2Y:CPQ-JS patelgv$ gulp build
[14:28:54] Using gulpfile ~/CPQ-JS/gulpfile.js
[14:28:54] Starting 'build'...
[14:28:55] 'build' errored after 1.38 s
[14:28:55] Error in plugin 'gulp-uglify'
Message:
/Users/patelgv/CPQ-JS/cpq.js: SyntaxError: Unexpected token: name (result)
Details:
fileName: /Users/patelgv/CPQ-JS/cpq.js
lineNumber: 6514
domainEmitter: [object Object]
domainThrown: false

Add specific bundle configuration to quote

Suppose I have a bundle "A" with 2 possible product options "B" and "C".

I want to use the quote.addProducts API call to add the "A" bundle with the "B" option but I'm not able to add the "B" option to the quote, just the "A" bundle.

In the context, I'm passing a product model for the bundle "A" and in the configuration key of the model I'm adding the configuration model for the option "B" in the optionConfigurations array. Yet it seems the API does not take that in consideration since only adds the bundle without the option to the quote.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.