Bhakti K
Bhakti K

Reputation: 25

Custom Record In NetSuite

I am fairly new to NetSuite. We have created a Custom Record for Consolidated Invoice (CI) ( Same customer, Same Insight Community, Combine invoices and create a Consolidated Invoice to send out).

The design of this module is like this :

Custom Records: Consolidated Invoice ( for the CI) Fields : Date,Amount, IC Number, Customer, CI ID, Subsidiary

Consolidated Invoice Child ( for the regular invoice) Fields : Date,Amount, IC Number, Customer, CI ID, Subsidiary, Currency, CI ID

Now, these two records together hold the data for Consolidated Invoice. Our issue is: The CI PDF should contains all the items from all the regular invoices its been made up of. I am not able to decide where to pull this items from, as we have not made them part of either of the records. I can add a items tab in the child form and may be fetch them? Any ideas please ? I also thought of a saved search on the fly to pull the items from the regular invoices. Is that a good idea ?

Upvotes: 1

Views: 1638

Answers (1)

bknights
bknights

Reputation: 15447

When I've done consolidated billing I make the child records the actual invoices. You should let the natural invoices process as normal and just use the Consolidated Invoice for customer communication.

Then in the script that creates the consolidated invoice:

var renderer = nlapiCreateTemplateRenderer();
renderer.setTemplate(templateBody.getValue());
...
//this uses a saved search for details because it allows admins to add new columns without having to script
var invResults = nlapiSearchRecord('invoice', invSearch, new nlobjSearchFilter('custbody_ci_parent', null, 'is', ciInternalId));
if (invResults) renderer.addSearchResults('invTrans', invResults);

and then in your template:

<#list invTrans as tran>...</#list>

Upvotes: 3

Related Questions