Export the login History

Posted by refael shira on 17-Feb-2019 09:06

Hello,
I tried to generate a report which include history login for every user.
can it's possible?

Regards,

Refael.

Posted by Srinivas Panyala on 18-Feb-2019 08:50

Hi Refael,

Please follow the below steps to generate the report.

1) Login as Administrator

2) Navigate to Rollbase -> Users -> Object Definition -> Reports

3) Click on New Report

4) Select JavaScript report type -> Click on Next

5)  Provide some report name

6) Select Content Type as HTML

7) Paste the following code in Header

rbv_api.println("<table border='1'>");

rbv_api.println(" <tr>");

rbv_api.println(" <th>USR_ID</th>");

rbv_api.println(" <th>LOGIN_TYPE</th>");

rbv_api.println(" <th>START_TIME</th>");

rbv_api.println(" <th>END_TIME</th>");

rbv_api.println(" <th>IP_ADDRESS</th>");

rbv_api.println("</tr>");

8)  Paste the following code in Loop body

var loginHistory = rbv_api.selectQuery("SELECT USR_ID,LOGIN_TYPE,START_TIME,END_TIME,IP_ADDRESS FROM $LOGIN where USR_ID =?", 100,{!id});

for(var i=0;i<loginHistory.length;i++){

rbv_api.println(" <tr>");

 for(var j=0;j<loginHistory[i].length;j++){

   rbv_api.println(" <td>"+loginHistory[i][j]+"</td>");

 }

rbv_api.println("</tr>");

}

9) Paste the following code in Footer

rbv_api.println("</table>");



See the below screenshot for reference.



10) Save the report
11) Preview/Run the report.

Sample report


Thanks
Srinivas

All Replies

Posted by Srinivas Panyala on 18-Feb-2019 08:50

Hi Refael,

Please follow the below steps to generate the report.

1) Login as Administrator

2) Navigate to Rollbase -> Users -> Object Definition -> Reports

3) Click on New Report

4) Select JavaScript report type -> Click on Next

5)  Provide some report name

6) Select Content Type as HTML

7) Paste the following code in Header

rbv_api.println("<table border='1'>");

rbv_api.println(" <tr>");

rbv_api.println(" <th>USR_ID</th>");

rbv_api.println(" <th>LOGIN_TYPE</th>");

rbv_api.println(" <th>START_TIME</th>");

rbv_api.println(" <th>END_TIME</th>");

rbv_api.println(" <th>IP_ADDRESS</th>");

rbv_api.println("</tr>");

8)  Paste the following code in Loop body

var loginHistory = rbv_api.selectQuery("SELECT USR_ID,LOGIN_TYPE,START_TIME,END_TIME,IP_ADDRESS FROM $LOGIN where USR_ID =?", 100,{!id});

for(var i=0;i<loginHistory.length;i++){

rbv_api.println(" <tr>");

 for(var j=0;j<loginHistory[i].length;j++){

   rbv_api.println(" <td>"+loginHistory[i][j]+"</td>");

 }

rbv_api.println("</tr>");

}

9) Paste the following code in Footer

rbv_api.println("</table>");



See the below screenshot for reference.



10) Save the report
11) Preview/Run the report.

Sample report


Thanks
Srinivas

Posted by refael shira on 18-Feb-2019 09:14

Hi Srinivas,

Thanx at lot.

It's work.

Best Regards,

Refael

Posted by refael shira on 18-Feb-2019 09:14

Hi Srinivas,

Thanx at lot.

It's work.

Best Regards,

Refael

Posted by refael shira on 18-Feb-2019 09:27

Hi Srinivas,

I have one more question:

it's possible to generate this data in document template?

Thank you,

Refael.

Posted by refael shira on 18-Feb-2019 09:27

Hi Srinivas,

I have one more question:

it's possible to generate this data in document template?

Thank you,

Refael.

Posted by Srinivas Panyala on 18-Feb-2019 09:42

Hi Refael,

I think we cannot generate this report in the document template. I am not sure about it.

You can export the login history of each user in XLS/CSV format from System info tab.

1) Login as Administrator

2) Navigate to Rollbase -> Users

3) Navigate to any user details page -> System Info tab

4) Navigate to Login History section

5) Click on Show All button

6) Now you can find the option "Export Full History: XLS | CSV"

Thanks

Srinivas

Posted by refael shira on 18-Feb-2019 12:41

Hi Srinivas,

Thanks but I want to export report automatically.

Refael

Posted by Srinivas Panyala on 19-Feb-2019 07:39

Hi Rafael,

I created a sample application. You can download from below link.

progresssoftware-my.sharepoint.com/.../EcCtSxjBDYdLqqHCw_fJKqwB0TfhSsl5_TAsGwjT-8jAjA

Follow the below steps

1) Install the above application xml

2) Navigate to Setup Home -> Batch Jobs -> Click on " CreateLoginHistory" job's Run Now (You can also schedule this job)

3) It creates records in LoginHistory object

4) Navigate to Dashboard Tab and click on "LoginHistory" Document template report. Login History report will be generated

I have created a batch job which removes old login history records from LoginHistory object and creates new records.

You can also add another "Generate Report" batch job to automatically generate this report. Schedule this job after "CreateLoginHistory" job. So that you can get the latest data in the report.

Thanks

Srinivas

This thread is closed