How-to Guide
Nue Platform
Invoice Preview Plugin
5 min
in particular circumstances, certain products in orders need to be excluded from the billing process to address this, you can set up billing schedule filters to remove them during billing however, it's equally important to ensure they are excluded from the invoice preview as well for example, the company smart revenue has a legacy system to bill and manage implementation projects so the company would like to exclude 'implementation service' from the invoice preview the user can follow the steps below to implement an invoice preview plugin to create a invoice preview filter using salesforce apex code step 1 implement invoice preview plugin step 2 register the plugin step 3 test the invoice preview step 1 implement invoice preview plugin create an apex class that implements the following interface ruby custompluginmanager invoicepreviewplugin note the apex class must be declared as ‘ global ’ since the interface is a global interface there are 2 interface methods in this plugin interface getexcludedquotelineitems(list\<id> quotelineitemids) implementing this interface method will add the capability to exclude specified line items during the invoice preview for quotes getexcludedorderitems(list\<id> orderitemids) implementing this interface method will add the capability to exclude specified line items during the invoice preview for orders and accounts / invoice preview plugin interface / global interface invoicepreviewplugin { // return a list of order item ids to be excluded from the invoice preview of orders and accounts the orderitemids includes a list of order product ids currently included in the invoice preview of orders and accounts list\<id> getexcludedorderitems(list\<id> orderitemids); // return a list of quote line items to be excluded form the invoice preview of quotes the quotelineitemids includes a list of quote line items currently included in the invoice preview of quotes list\<id> getexcludedquotelineitems(list\<id> quotelineitemids); } please see an example below / example excludes line items containing products with name 'implemention service' in the invoice preview of quotes, orders and accounts / global class invoicepreviewpluginimpl implements ruby custompluginmanager invoicepreviewplugin { // excludes line items from the invoice preview of orders and accounts global list\<id> getexcludedorderitems(list\<id> orderitemids) { list\<orderitem> lineitems = \[select id, ruby productname c from orderitem where id in \ orderitemids]; list\<id> excludedlist = new list\<id>(); if (lineitems != null) { for (orderitem item lineitems) { if (item ruby productname c == 'implementation service') { excludedlist add(item id); } } } return excludedlist; } // excludes line items from the invoice preview of quotes global list\<id> getexcludedquotelineitems(list\<id> quotelineitemids) { list\<quotelineitem> lineitems = \[select id, ruby productname c from quotelineitem where id in \ quotelineitemids]; list\<id> excludedlist = new list\<id>(); if (lineitems != null) { for (quotelineitem item lineitems) { if (item ruby productname c == 'implementation service') { excludedlist add(item id); } } } return excludedlist; } } step 2 register the plugin login to your salesforce org and navigate to setup search for ‘custom setting’ and navigate to the custom settings list page click on the ‘manage’ link on ‘nue system setting’ search for 'invoicepreviewplugin’ and click ‘edit’ if there is no entry found, create a new record with the following information name invoicepreviewplugin category custom plugin description invoice preview custom plugin label invoice preview plugin in the value field, enter your apex class name, e g , invoicepreviewpluginimpl, and click 'save' step 3 test the plugin now the plugin is ready to be tested please refer to preview invoices docid\ ezhcu0ywxtmu5cxhkbsoj to enable invoice preview and test that the plugin works for quotes, orders and accounts
🤔
Have a question?
Get answers fast with Nue’s intelligent AI, expert support team, and a growing community of users - all here to help you succeed.
To ask a question or participate in discussions, you'll need to authenticate first.