Transaction PDF
When requesting a Transaction PDF, use the requestJSON to pass the required transaction details, and the response will have responseJSON which stores the PDF response returned by NetSuite.
The requestJSON has the following parameters.
Field Name | Data Type | Description |
|---|---|---|
tranType | string | Pass the supported transaction type |
tranId | string | Internal Id of the Transaction |
templateId | string | Template Id of the PDF format stored in the NetSuite File Cabinet |
requestURL | string | External URL of the Script Deployed |
| | |
Go through the following help article to generate the templateId and requestURL:
Supported Transactions Types:
- estimate
- salesOrder
- invoice
- creditMemo
- cashSale
- cashRefund
- customerPayment
- returnAuthorization
- itemFulfillment
- purchaseOrder
- vendorBill
- vendorCredit
- vendorPayment
- vendorReturnAuthorization
- expenseReport
- check
Example to get the Invoice PDF (in a Blob content):
Map<String, Object> tranfilters = new Map<String, Object>();
tranfilters.put('tranType', 'invoice');
tranfilters.put('tranId','28');
tranfilters.put('templateId','735');
tranfilters.put('requestURL','https://111222.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=133&deploy=1');
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('transactionPDFDetails', new List<Object>{tranfilters});
String reqJSON = JSON.serialize(requestJSONMap);
Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version', '1.0');
reqObj.put('action', 'getTransactionPDF');
reqObj.put('requestJSON', reqJSON);
// Place a request to Breadwinner Global API
Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);
System.debug(resp);Use the response to download the PDF of the transaction. You can achieve this by writing JavaScript to handle the blob content, using the Salesforce Attachment object, or a combination of both approaches.