Do you need the user id saved on the database, or you only need the user name displayed on the object property page?
If display the name on the object property edition pages is enough, you can try to use a parameterized dynamic lookup.
This lookup will allow you to choose an user. But while no user is chosen, a default user is displayed.
To test the concept, try to created a lookup with the following NSQL:
select
@select:tbl.id:id@,
@select:tbl.name:name@
from
(select
usr.id id,
usr.first_name || ' ' || usr.last_name name
from
cmn_sec_users usr
where
1=1
union select
-1 id,
usr.first_name || ' ' || usr.last_name name
from
cmn_sec_users usr
where
(usr.last_name || ', ' || usr.first_name) like @where:param:user_def:string:code@
union select
-1 id,
'Showing the creator' name
from
dual
where
@where:param:user_def:string:code@ is null
) tbl
where
@filter@
(watch out: this nsql gets all users, even inactives and locked users)
Then, create a lookup field that uses the above lookup on an investment-based object (project, for example...). For the parameter code, select the 'Created By' field. And choose as default value 'Showing the creator'.
That's it!
Main downsides:
- it will only show the creator user on the property edition pages. On the creation page and in the list view, you will see 'Showing the creator' instead...
- it is not easy for the user to choose back the creator user after another user is chosen (I really don't know if this is a real downside...)
Regards,
Roberto Barra