0

Is there a way to check a folder for new files or to check the age of a file?

For example, if I have a few files in a folder, is it possible for me to find out which one is the newest using JavaScript?

VicDid
  • 175
  • 2
  • 20

2 Answers2

2

You can probably do a document search and sort the results by Date Created in descending order.

Rusty Shackles
  • 2,802
  • 10
  • 11
2

You can also do a saved search using SuiteScript:

x = nlapiSearchRecord('file', null, ['folder', 'anyof', YOUR_FOLDER_ID], [new nlobjSearchColumn('created').setSort(true)]);

You will get the recently created file first in the search result.

Alternatively, you can create the Document search from UI as suggested by @RUSTY and then load the same search using nlapiLoadSearch() API

prasun
  • 7,073
  • 9
  • 41
  • 59