I want a activity log to be displayed on click of ui action. By defalut its shows maximum 250 entries as per glide.history.max_entries system Properties.

shwetat
Tera Contributor

I want a activity log to be displayed on click of ui action. By defalut its shows maximum 250 entries   as per glide.history.max_entries system Properties.

I want is to fetch next 250 entries on click of UI action.

Please let me know if somebody has done something like this.

Or help me with the approach.

Is this possible to fetch the dat afrom sys_history_line table??

Thanks

Shweta Thkaur

7 REPLIES 7

jagan
Kilo Explorer

1st time clicked on UI Action:



Onclick of UI Action, do glide record to sys_history_line table sory by 'created' field . if there are more than 250 records in that table.



update 250 records data on the activity and store the sys_id of 250th record in a separate custom field (create a new field).



2nd time clicked on UI Action:



When the next time you click on UI Action button, do glide record to sys_history_line sort by 'created' field and skip all the rows (because we already updated this data on activity field) till the current record sys_id matches with the sys_id stored in custom field.




Once the matching record found, get the next 250 records and update that data in activity field and clear the previous value stored in custom field and update with the last updated record sys_id in the custom field (when second time clicked).



3rd time clicked on UI Action


When 3rd time clicked on UI Action , again above steps will be repeated




I hope this will help you ..



Thanks,


Jagan


shwetat
Tera Contributor

Hi Jagan,


Thanks for the Response, I have gone through the approach of glide on history line table but its giving heavy performance issue..


I just tried with   query,


with setLimit(1). but still page is showing load for long and no reponse.


.Could you please try and check at your end also. if glide on sys_history line is working for you.


Please let me know your findings.



Thanks


Shweta


Hello Shweta,



It depends on the volume of data and addQuery filters applied to the query. I am assuming that you are also querying sys_history_set before querying sys_history_line ? If you can share the query what you have written I'll take look at it.


shwetat
Tera Contributor

Hi jagan,


I was only querying to sys_history line table directly by picking one incident sys id in the sys_history_line table.


there where 11 records for that incident in sys_history_line.


below is the query.




var gr = new GlideRecord('sys_history_line');


gr.addQuery('set','1e36ac76c9ea8200804bac24fae0e5d9');


gr.setLimit(10);


gr.query();


while(gr.next){


gs.addInfoMessage("Test1111"+ gr.set);


}


gs.addInfoMessage("Test");



and its was not working out my instance started giving blank screen.


please let me know the way you have tried.



Thanks


shweta