Question

Notify Admin if any user exports data using "Export To Excel"

Hi,

 

We need to notify the admin if any user exports data using Export to Excel option. I have created a small business process to create the notification. I need to call this business process when someone exports the data. I see the exportToExcelFile() in Data Utilities that calls ReportService to generate the report, but not sure how to override this function to call the process after the service is called. Any help is much appreciated. 

Like 1

Like

4 comments

Hi,

You can add replacing module to the schema BaseDataView and call your business-process in the method exportToExcel.

 define("BaseDataView", [], function() {
	return {
		messages: {},
		mixins: {},
		methods: {
			exportToExcel: function() {
				this.callParent(arguments);
 				console.log("Test!!!!");
			}
		},
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
	};
});

Example of how to run a process you can find here.

Dmytro Vovchenko,

Thank you Dmytro! 

I already tried this. But the problem is that if the user does not have the Export Permission, this function still executes and the process runs to notify the admin that the user exported when in reality he could not. 

I saw the exportToExcelFile() in Data Utilities where the actual service ReportService is getting called. Will probably need to add the process call there to ensure the process is called only when the file is downloaded. But I'm not sure how to replace that module. I am unable to find that in the parent list in Replacing View Model. Please provide your insights. 

 

Regards,

Nirupama Mohan Latha,

 

hello! You can add your own operation permission check using the RightUtilities module and the checkCanExecuteOperations method inside the replaced exportToExcel method and trigger or not trigger the process as a result of this check.

Oleg Drobina,

Thank you Oleg! I can try that but will it also work when trying to export from Detail grids? When I tested I did not see this function getting executed. Let me know if I'm missing something.

Show all comments