This content has been marked as final. Show 7 replies
Hi number 931509 ;)
You can use the user in PL/SQL via :APP_USER
To set an item value with the logged in username you can set the default value to PL/SQL expression and user :APP_USER as the expression.
If this is not working tell us where/how you want to use it and also your APEX version and authentication method ( database/APEX account ?? ).
I am very new to this environment..
first I am using Application Express 4.0.2.00.09
now if you can guide me step by step where should I go to update the field that will be highly appreciated
here is my table and I have created a page for it. what I am looking for exactly is to have the field USER ID filled automatically as you mentioned with the APP_USER once the form is opened and it should also be uneditable.
I am sure you have gone through this everyday and it's very simple but I need the steps please.
also the expression to be written.
thank you again.
the situation gets a little bit more complex nopw, since you want to show the value display only but also want to update the field in the database ( which is a contradiction for APEX ).
So it would be easiest to do it one step at a time if you're not familiar with this.
First step would be to set the database USER_ID field which is already on your form.
Go to the form page in APEX which you want to edit and open the USER_ID page item.
Go to the TAB Default ( for this item ) and set the field Default Value to
And also set the field Default Value Type to
Now if you run the form to create a new record this field should be populated with the application user who is logged in.
Next step would be to hide this field and create a new readonly field which is just to display the value on your form.
So first set the USER_ID field to Hidden ( property Display as )
Next create a new page item of type Display Only and during the creation of this item set the "Source type" to PL/SQL expression and again set the expression to :APP_USER
Now you also have a read only field which shows this value.
Since APEX does not update the display only fields in the database when you submit the page (that's probably why they are called "Display only" :) ) you have to create a work around.
The example I gave you is the method I usually use.
Another way would be to create a dynamic action which disables the item on "Page load"
Also create a dynamic action which enables the item again on "Before page submit", make sure this is not fired on page load ( this is the default when you create the DA ).
No when you load the page the item gets disabled ( read only ), and just before submit it get's enabled again. The downside is that when your application is slow you can see the item getting enabled and there might still be a gap for the user to change the field value, that's why I prefer the first method.