This is about displaying a "Report on Incidents" based on the "Organization" on the Customer Portal. We will be entering the Organization in an input box and then on clicking on "submit". The Incident Report should be displayed only for that Organization.
This is happening but the "Logged In" contacts Id (c_id) is also getting passed as a filter to that Incident Report.
Is it possible to remove the c_id filter that's imposed on the above Incident report? How do I remove this contact ID filter from Incident report?
Someone suggested to use the pre_report_get_data hook and then unset the Contact ID (c_id) filter. But I was not able to figure out how to do that.
Can someone give me a code snippet to remove the c_id filter using pre_report_get_data hook? Or some other solution to this problem.
Copy the report that you want to edit to a new version, then edit the filters of the report as you see fit. You won't be able to edit the default canned reports directly, but with a copy, you can edit it completely.
EDIT
Contact filters are always applied on Customer Portal filters because of the user model on Customer Portal. CP expects that a user on the web is a specific customer and should only have access to contact data that is specific to the particular contact in the user session. This is a security mechanism and is working as intended.
If the goal is to display data from reports that might have contact data related to it, but should be exposed to all contacts, then you should probably write a custom widget that runs a ROQL or Analytics API query directly, but be wary of the potential to expose other customer data if implemented incorrectly.
If you want to use the pre_report_get_data hook, then it's pretty simple to enable the hook in the settings/hooks.php file. Point the hook to the model and method that you want the hook to call. Then, edit the passed array of data to unset c_id from the filters array, as was mentioned in the other post.
That tells the hook engine to call the
report_run()
method in thefilter_report
model. These are typically example code files in CP, so you should have most of the work already done to implement that hook.