There are scenarios when we need to get the current user logged in oracle fusion hcm ERP or SCM applications and we may want to do further processing related to the current user.
So there are a few ways , lets discuss
Table of Contents
Get current logged in user for passing to external url
When you are logged in Oracle Fusion cloud and want to call external url with paramter as user name
you can write a custom java script and use the bindings parameters
#{webCenterProfile[securityContext.userName].firstName}
You can use this EL Expression To Get Current Logged In User in Fusion
#{securityContext.userName}
Write a Custom BIP query expose the report as web service
This SQL query shows all the users who are currently logged in to the instance.
SELECT pu.username "LOGIN_USERNAME", pu.SUSPENDED, pu.creation_date, max(fs.LAST_CONNECT) "LAST_CONNECT", max(fs.LAST_UPDATE_DATE) "LAST_UPDATE_DATE" FROM per_users pu, FND_SESSIONS fs WHERE 1=1 AND pu.user_guid = fs.user_guid AND trunc(fs.LAST_CONNECT)=trunc(SYSDATE) GROUP BY pu.username, pu.SUSPENDED, pu.creation_date ORDER BY pu.username DESC
Showing the user name in a BIP report
Use the session variable and add to the BIP RTF
VALUEOF (NQ_SESSION.โUSERโ)
Use the SQL query to create a data model and fetch the user running the report.
select * from PER_USERS where upper(USERNAME) = upper(:xdo_user_name)
How to get the email address of the current user in OTBI Analysis?
ย
1) Go to OTBI / Analytics
2) Navigate to the report
3) Edit the report and go to Criteria tab
4) Add a filter on a column by using session variable filter โ USER
See this example:
SELECT
โEmployeeโ.โEmployee Login Nameโ saw_0,
โEmployeeโ.โEmployee Email Addressโ saw_1,
โEmployeeโ.โEmployee Nameโ saw_2,
โSales Account Resource Factsโ.โ# of Sales Account Resource Rolesโ saw_3
FROM
โSales โ CRM Sales Account Resourceโ WHERE โEmployeeโ.โEmployee Login Nameโ = VALUEOF(NQ_SESSION.โUSERโ)
How to pass the current logged-in username from Fusion to an external url using EL expression?
Replace the hardcoded username with #{securityContext.userName} in the URL
Steps :
- ย Login to fusion
- ย Create and Activate a new sandbox
- ย Go to Navigator > Structure
- ย Click on โCreateโ and select โCreate Page Entryโ
- ย Fill the inputs as per your requirement.
- ย Enter external URL of your choice in โDestinationโ as shown in below screenshot. ย
ย ย ย ย ย ย ย ย ย ย ย Ex : https://www.google.co.in/search?q=#{securityContext.userName}
ย ย ย ย ย ย ย 7. Test the changes by clicking on the newly created page.
ย ย ย ย ย ย ย 8. You will be navigated to External site with the current logged in user name in the URL.
more fusion apps tech