Files such as image, text or media can be attached to record such as Sales Order.
For users who would like to count the number of attached files through script, this is not directly possible.
The file is under a sublist of the record, and as per most scriptable records, running script directly to a sublist is not supported.
As an alternate solution, follow steps below to count files attached to a record:
1. Create a Saved Search with the following criteria:
- Type - Sales Order
- Internal ID - (Sales Order Internal ID)
- Main Line - is True
- File: Date Created - is not empty
* Note that the search itself cannot be scripted since 'file' is not a valid join field.
2. Use created Saved Search on script to get/count the results.
var attachedFiles = nlapiSearchRecord('salesorder','customsearch101');
var numAttached = attachedFiles.length;
Result >> numAttached = 2
DISCLAIMER: Thesample code described herein is provided on an "as is" basis, withoutwarranty of any kind, to the fullest extent permitted by law. Oracle + NetSuiteInc. does not warrant or guarantee the individual success developers may havein implementing the sample code on their development platforms or in usingtheir own Web server configurations.
Oracle +NetSuite Inc. does not warrant, guarantee or make any representations regardingthe use, results of use, accuracy, timeliness or completeness of any data orinformation relating to the sample code. Oracle + NetSuite Inc. disclaims allwarranties, express or implied, and in particular, disclaims all warranties ofmerchantability, fitness for a particular purpose, and warranties related tothe code, or any service or software related thereto.
Oracle +NetSuite Inc. shall not be liable for any direct, indirect or consequentialdamages or costs of any type arising out of any action taken by you or othersrelated to the sample code.
Post a Comment