ftos.files.getDeleted
IMPORTANT!
Starting with v24.3.0, this is renamed from getDeletedFiles to ftos.files.getDeleted.
Starting with v24.3.0, this is renamed from getDeletedFiles to ftos.files.getDeleted.
Returns orphan files information (files that have no entity link due to entity changes or removal).
This is a business logic method for business service components.
Syntax
function ftos.files.getDeleted(fromDate: string, toDate: string, bulkNumber: number): any
| Parameter | Description |
|---|---|
fromDate (optional) |
Return only files created after this date. |
toDate (optional) |
Return only files created prior to this date. |
bulkNumber (optional) |
Maximum number of files to return. |
Return Value
Returns an array of JSON objects containing the deleted files' attributes, e.g.:
[
{
"FileEntryId": "9d384a98-602b-4293-8679-6287baef92e3",
"RealName": "report1_9d384a98-602b-4293-8679-6287baef92e3.pdf",
"RelativePath": "report1_9d384a98-602b-4293-8679-6287baef92e3.pdf",
"CreatedOn": "2020-01-13T16:22:42.44",
"CreatedBy": "4afdc8a9-eb91-4359-81d6-c3a462fae866",
"EntityName": "Reports",
"EntityPKId": "e6336d49-3571-42dd-9228-4bc1e599bd95",
"DeletedOn": "2020-01-13T16:23:20.303",
"AttributeName": "file",
"DeletedBy": "4afdc8a9-eb91-4359-81d6-c3a462fae866"
},
{
"FileEntryId": "ddde85d9-ca38-42b8-b6b9-e5cc6bb4078c",
"RealName": "report2_ddde85d9-ca38-42b8-b6b9-e5cc6bb4078c.pdf",
"RelativePath": "report2_ddde85d9-ca38-42b8-b6b9-e5cc6bb4078c.pdf",
"CreatedOn": "2020-01-13T16:23:15.1",
"CreatedBy": "4afdc8a9-eb91-4359-81d6-c3a462fae866",
"EntityName": "Reports",
"EntityPKId": "e6336d49-3571-42dd-9228-4bc1e599bd95",
"DeletedOn": "2020-01-20T13:51:06.49",
"AttributeName": "file",
"DeletedBy": "4afdc8a9-eb91-4359-81d6-c3a462fae866"
}
]
Examples
In this example, we store information about all the orphan files in a variable called orphans.
var orphans = ftos.files.getDeleted(null, null, null);
In this example:
- We store information about up to 20 orphan files created between 2020-01-01 and 2020-01-31 in a variable called orphans.
- We log each file's RealName and date it was DeletedOn in the trace_roll.log file. For details on how to save log messages, see ftos.logging.log.
var orphans = ftos.files.getDeleted('2020-01-01', '2020-01-31', 20);
orphans.forEach(function(item, index, array){
log(item.RealName + ' was deleted on ' + item.DeletedOn);
});