#1 2025-05-13 14:44:52

Sabina
Member
Registered: 2025-05-13

Get user who executes report

Hi,

Is there a way to pass to a Jasper report the details of the ReportServer user executing the report?

I searched the docs and the forum and found nothing on this.



Regards,
Sabina

Offline

#2 Yesterday 10:04:19

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Get user who executes report

Hi Sabina,

you can access your user in Jasper by creating a parameter (only in Jasper!) like this:

<parameter name="_RS_USER_FIRSTNAME" class="java.lang.Object"/>

You can use of course String for text.

Then you can print it in your jasper like any other parameter:

<textField>
   <reportElement x="138" y="70" width="138" height="60" uuid="88a0b516-0d6a-48b8-8ae8-b479b35a948b"/>
   <textFieldExpression><![CDATA[$P{_RS_USER_FIRSTNAME}]]></textFieldExpression>
</textField>

The user fields that are accessible are:

  • _RS_USER_FIRSTNAME

  • _RS_USER_LASTNAME

  • _RS_USER_USERNAME

  • _RS_USER_TITLE

  • _RS_USER_EMAIL

  • _RS_USER_ID

Regards,
Eduardo

Offline

#3 Yesterday 15:00:30

Sabina
Member
Registered: 2025-05-13

Re: Get user who executes report

Thank you, it was very helpful.

Offline

Board footer

Powered by FluxBB