Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Using logged user inside a QuickQuery

(0) ShareShare
ReportReport
Posted on by 16

Are there any hints on how to use the current userid value inside a QuickQuery view?

I've been trying to use the PES table, but I don't really understand how it works.

I'm setting up a view using the built in SQL funcions like SYSTEM_USER and CURRENT_USER. I'm using a Windows based authentication scheme, so this should work. I still can't get a working query though.

Thanks in advance.

*This post is locked for comments

  • Verified answer
    Erich Strelow F Profile Picture
    16 on at
    RE: Using logged user inside a QuickQuery

    Ok, I finally hacked into it. 

    I never really understood the 07718158D19D4f5f9D23B55DBF5DF1 and E8F575915A2E4897A517779C0DD7CE tweaks. It seems that the QQVIE00.EXE process establish a proper SL environment and then starts an anonymous .Net SqlClient Data Provider session to fetch the data. So, you should be able to locate other SQL processes that are originated from the same client QQVIE00 process, a value available through the host_id() built in function.

    This approach sould work only under some conditions.

    I think this is against Quick Query intended focus. What I need is an outlook grid showing "My transactions" with drill down and excel-export capabilities. Role center should be a contendor for this.

    /*******************************************************************
       xQQ_User()
       
       Returns the Application User currently querying a QQ view
       
       Notes:
       This works for Windows Authentication mode
       
       SL 2011 itself executes the QQ query under an anonymous session.
       This function does a redirection searching for the authenticated 
       user owner of the same QQVIEW00 process in the client
       machine. 
       This should work only under specific scenarios under the SL full 
       client.  
    ********************************************************************/
    create function xQQ_User() returns char(47)
    with execute as  '07718158D19D4f5f9D23B55DBF5DF1'
    as
    begin
    return (
       select userid
       from dbo.vs_userrec
       where WindowsUserAcct = (
          select max(loginame)
          from sys.sysprocesses
          where hostname like HOST_NAME() + '%' and
          hostprocess=host_id() and 
          spid <> @@spid
       )
    ) ;
    end;
    


  • Erich Strelow F Profile Picture
    16 on at
    RE: Using logged user inside a QuickQuery

    I am revisiting this issue. It seems that the SQL session that executes the query is always the E8F575915A2E4897A517779C0DD7CE user.  There's no context change and no host information. There is no PES record either.

    So, the QQ execution seems strictly anonymous for the time being.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

#1
Community Member Profile Picture

Community Member 136

#2
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 102 Super User 2025 Season 1

#3
REUser Profile Picture

REUser 8

Featured topics

Product updates

Dynamics 365 release plans