Avoiding the use of getLast()

The getLast() method for an SCFile object will select the last record of the list of results to the currently selected records. However, accessing the last record in a long list of records is not really a good idea. Since ITSMA Service Management selects always a block of unique keys, this method requires Service Management to blockwise step through the complete result list, until it gets to the last one and then fetches its contents.

Unrecommended implementation

The following information is not recommended:

var file = new SCFile("probsummary");
file.doSelect('true');
file.getLast();

Alternatively, you can set the result order by the setOrderBy() method at the time of the select. You can change the sort order that the record you are looking for is no more the last in the list, but the first.

Recommended implementation

The following implementation is recommended:

var file = new SCFile("probsummary");
file.setOrderBy(["number"],[SCFILE_DSC]);
file.doSelect('true');