Skip to main content

When utilizing the database function `dbo.tsf_user()` in a stored procedure, the value does not resolve the user requesting/executing the stored procedure, while using Indicium to do the request.

To sketch 2 similar, but different situations.

  1. A process flow is executed through the Windows GUI.
    1. Stored procedure is executed while generating a report in DevExpress.
    2. Stored procedure utilizes `dbo.tsf_user()`, which results in the currently logged in user, the one executing the query.
  2. A process flow is executed through the Universal GUI.
    1. Stored procedure is executed while generating a report in DevExpress.
    2. Stored procedure utilizes `dbo.tsf_user()`, which does not result in the currently logged in user, the one executing the query.

For other features in SQL, this error does not occur, for example for building certain views, functions, etc…

However, for the stored procedure that is being used in the DevExpress report the currently logged in user is not being retrieved. Causing our reports to not report the correct information.

Hi Stijn, 

Since Indicium is a service tier and not much of a server/database instance, Indicium cannot fetch the user in that context. Using tsf_original_login() instead, will retrieve the user currently logged in through that session, resulting in the user ID from that procedure. Keep in mind the following from the documentation page:

The tsf_user() does not return the correct user ID when called by Crystal Reports reports. You can provide the user ID to the report by using an input parameters. Make sure to always set the user ID in the default so that the value can not be tampered with when using Indicium.

Since tsf_original_login() uses the session context (the session variable tsf_original_login), it only works in combination with Indicium and not for a 2-tier Windows GUI. When used without Indicium it functions similar to tsf_user().

Hopefully the other procedure will do what you expect! 

 

Best regards, 

Jochem


Hi Stijn,

I wanted to double check why it would not work when using Indicium with DevExpress reports.

For my test case, I created a stored procedure on the database that just did: select 'Dummy ' + dbo.tsf_user()

I added that stored procedure to my report and execute the report and my username was correctly shown. My colleague also validated that he saw his username.

So, it looks like it should be working correctly. We are using the latest Indicium version.

You mentioned you are using a process flow - does it work when you open the report directly?
In any case, can you show us the process flow? Are you using the “Start report/start table report” actions or are you using “Generate report”?

Regards,

Dick van den Brink


Hi Dick & Jochem,

We are using a process flow with a generate report, and then a write disk file (non-file storage) process action. For context, other reports generated with the same process actions that do not use a procedure with either tsf_user() ot original_login() are generated correctly.

To test on our end, I added the following select statement in the stored procedure added to a DevExpress report:

 

The result of these are:

(Devexpress)

(Generated pdf).

 

We are using indicium 2025.2.10. I don’t see anything specific in the patch notes in those two small fix-updates. From 2025.2.10 to 2025.2.12.

 

Executing the same flow on Windows results in:

 


Hello ​@Stijn Schuurman,

The Generate Report process action always runs in system context, not in user context.

This process action was designed with the main intention being usage within system flows. It can also be used in process flows that are initiated by users of course, however, even then the process action will run in system context.

I can see this being a situation that we can take under advisement or at the very least make note of it in the documentation.


@Vincent Doppenberg In line with ​@Jochem Pieper’s answer, there’s a note here in the Docs regarding Crystal Reports: https://docs.thinkwisesoftware.com/docs/sf/functionality#parameters

 

Does the same apply for DevExpress? Then we’ll make sure to amend the Docs.


Yes, you can store the username in a process variable while still in user context and then pass it to the report as a parameter.


Reply