0

When I create a record I'd like to populate one of the fields (P34_CONTACT) with current ldap user.

enter image description here

I am creating a dynamic code with (picture above):

apex.item("P34_CONTACT").setValue(:FULL_USER_NAME)

I am getting an error:

Uncaught SyntaxError: Unexpected token ':'

When I remove colon, I get:

Uncaught ReferenceError: FULL_USER_NAME is not defined

My authetentication schema is as below:

enter image description here

When I set a fixed name: apex.item("P34_CONTACT").setValue("FULL_USER_NAME") Field is being populated with "FULL_USER_NAME", so basically I need a correct variable or proper syntax Could anybody please assist?

Kondjitsu
  • 19
  • 1
  • 1
  • 4

1 Answers1

0

First, you should modify your PL/SQL code in the authentication scheme to set the :FULL_USER_NAME value. Below is the example:

apex_util.set_session_state('FULL_USER_NAME', util_ldap.gv_displayName);

Then, create a hidden page item, for example, P1_FN and set its default value as the item, and specify that application item FULL_USER_NAME. Then you would be able to get it using the following:

apex.item("P34_CONTACT").setValue(apex.item("P1_FN").getValue());

Vinish Kapoor
  • 669
  • 1
  • 7
  • 13
  • Hi Vinish, thanks for your input, but that didn't work. And you have provided value in quotes, which means, that it will be provided as a string ("FULL_USER_NAME") and I need variable :FULL_USER_NAME to be used, or some other variable defining current user – Kondjitsu Feb 17 '21 at 07:09
  • Oh ok, I have edited the answer, please check. – Vinish Kapoor Feb 17 '21 at 07:35