Happy Business Starts Here

Zuora Support

Import Tax amount from Zuora to salesforce

Customer wants to get the Invoice amount generated in Zuora and want to use that value in Salesforce calculations.zuoraTaxquery.PNG

For example in In the attached image Tax amount is 69.55 in zuora and customer wants to fetch this value from Zuora and use it in Salsesforce.






If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

1 REPLY 1
Zuora Support

Re: Import Tax amount from Zuora to salesforce

We can use the query method from order builder functionality to fetch the values directly form Zuora and we can use that for the calculations.

Below is the Knowledge article describes Order Builder.

https://knowledgecenter.zuora.com/CA_Commerce/I_Development_Resources/B_Order_Builder

 

Below is the Query Method usage example from Order Builder

https://knowledgecenter.zuora.com/CA_Commerce/I_Development_Resources/B_Order_Builder/D_Programming_...

 

To achieve the requirement we need to query the invoice object record from zuora and need to use that value.

Below is the example on how to query invoicec object using order builder

`````````

// zApiInstance should be instantiated and the login() method must
// have been invoked prior to invoking any other method on the
// object
Zuora.zApi zApiInstance = new Zuora.zApi();
zApiInstance.zlogin();
try {
    String zoql = 'SELECT Id,TaxAmount from Invoice Where AccountId =\'2c92c0f866a9a8fa0166aede209b0740\'';
    List<Zuora.zObject> zobjs = zApiInstance.zquery(zoql);

    for (Zuora.zObject o : zobjs) {
        Decimal Taxamt = (Decimal)o.getValue('TaxAmount');
        system.debug('Tax amount--- '+Taxamt);
        //more code here... according to requirement  ....
    }
} catch (Zuora.zRemoteException ex) {
    if ('INVALID_FIELD' == ex.code) {
        // An invalid field was specified
        //more code here...
    } else {
        //more code here...
    }
} catch (Zuora.zAPIException ex) {
    ex.getMessage();
    //more code here...
} catch (Zuora.zForceException ex) {
    //more code here...
}

````````````````

 






If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √