Report show the latest record
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2024 02:52 AM
Hi all,
One employee have multiple records in the table(Voluntary Agreement to Work Extra Hours), but I would like to only show the latest one in report. Could anyone help on this.
Thank you
Best Regards,
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2024 02:56 AM
Hi @Jeff42
Hope this helps you. please refer below mentioned document.
If this helps you please accept the solution and mark it as helpful.
Thanks
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2024 03:04 AM
thank you for your link, but don't know why not work for me, below my script include:
var Voluntary_Agreement_Latest_Record = Class.create();
Voluntary_Agreement_Latest_Record.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
getLatestRecord: function(){
var EmployeeID;
var gr = new GlideRecord("sn_hr_core_voluntary_agreement_to_work_extra_hours");
gr.addActiveQuery();
gr.setLimit(1);
gr.orderByDesc('sys_created_on');
gr.query();
if(gr.next()){
EmployeeID = gr.sys_id;
}
return EmployeeID;
},
type: 'Voluntary_Agreement_Latest_Record'
});