Modifying the title of a custom generated report with current timestamp

Hi Team,

Wanted to discuss if we can modify the title of a generated report and append the current execution timestamp. Also when we click on download, is it possible to download the report in csv/pdf with the current timestamp ?

Thanks
Arijit

Your question intrigues me, so I went digging for information.

Turns out the My Report page is saved as TaskDefinition objects, with a type attribute = “LiveReport”. The name attribute determines the name of the report result and CSV/PDF file names.

Sadly it does not support parameters in the name like certification does.

So you will have to either:

  1. Rename the TaskDefinition object before it gets executed. How is the big question here. Perhaps by extending the original task definition class.

  2. Inject JavaScript to capture unfocus event on the text field Edit Report page, edit in a timestamp. This cannot handle the user running the same report twice without editing it first.

For 2) you can do something like this:

    var ctrl = $('input[name="name"]')[0];
    if (ctrl) {
        ctrl.addEventListener("blur", function() {
            console.log("Name unfocused, add timestamp if not already have one");
        });
    }

You can inject that JS with a plugin snippet (Plugin Manifest File).

The URL to match is /identityiq/analyze/reports/editDefinitionForm.jsf.

1 Like

Appreciate your response.

This was a requirement for us. I believe this feature should be enabled OOTB, as customer might need the date on the report title.

For now once we download the PDF, it displays the date bottom left which is OOTB, fortunately customer is ok with this.

We also thought to do a rule runner task to read the report, and download the pdf file to a specific location appending with date. But customer is ok for now.

But again thank you again for putting effort and time on to my question, really appreciate.

Thanks
Arijit

Since the items in My Report is actually a TaskDefinition, I remembered something.

In TaskDefinition XML, there’s an attribute called resultAction.

From JavaDoc, it has these possible values:
Cancel
Delete
Rename
RenameNew
RenameNewWithTimestamp
RenameNewWithUID
RenameWithTimestamp
RenameWithUID

When you create a new TaskDefinition, it is displayed on the right side as “Previous Result Action”. Curiously, not all the enum values are included in the dropdown list.

I created a new report, the default value is “Rename”. In debug mode, I changed it to “RenameNewWithTimestamp”.

The first report result generated with have the report’s name. Starting from the 2nd one, the name will be timestamped.

But sadly that doesn’t change the download file name:
image

You will have to find a way to edit the TaskDefinition before it runs somehow…