As opposed to scheduled reports, ad-hoc reports are created for a one-time use. In BillingPlatform, they can be executed through workflow so that reporting can be triggered on a event.
To accomplish this through the API, proceed as follows:
- Create a task specifying which report to run by sending a CREATE request for the ADHOC_SCHEDULED_REPORT entity. The example below shows how to create a task for the Account Aging Report:
{
"brmObjects": [
{
"CustomReportIdObj": {
"Name": "Account Aging Report"
}
}
]
}
NOTE: Make sure to replace "Account Aging Report" with the name of the report you want to run.
- Add report variable values by sending a CREATE request for the ADHOC_SCHEDULED_FILTER entity. For successful submission, each filter must have a label and must be submitted separately, as shown in the example below:
{
"brmObjects": [
{
"AdhocScheduledReportId": "ID from ADHOC_SCHEDULED_REPORT",
"Name": "Bill Cycle Start Date",
"Value": "06/01/2023"
},
{
"AdhocScheduledReportId": "ID from ADHOC_SCHEDULED_REPORT",
"Name": "Bill Cycle End Date",
"Value": "06/30/2023"
}
]
}
NOTE: Make sure to replace ID from ADHOC_SCHEDULED_REPORT with the actual ID obtained from the ADHOC_SCHEDULED_REPORT creation process.
- Run the task to generate a report by updating the ADHOC_SCHEDULED_REPORT entity and changing the value of its ReadyForExecution parameter from 0 to 1.
{
"brmObjects": [
{
"Id": "string",
"ReadyForExecution": "1"
}
]
}
To cancel a report that is queued for generation or is being generated, follow the instructions in Cancelling Ad-Hoc Reports.