How to auto populate User id in a reference field in scoped apps

vahini
Giga Guru

Hi All , 

I need help with situation explained below . 

i am working in a scoped app  called  'Lab client'  ,on lab form  i created a reference field 'Recorded By'  which reference to sys_user table . 

i am trying to auto populate it with logged in user id . for this i used  " javascript:gs.getUserID() " in atrributes  , it didn't work . used it in default value too , it didn't work . 

i changed the default value or attribute to   "gs.info(gs.getUserID());"  , didn't work . 

info about current functionality : 

as shown below , visit notes is the field . 

 

find_real_file.png

when user types something in this field , then two fields appear above Recorded by and spoke date  as shown

find_real_file.png

when user selects a user in recorded by field and selects a date  in spoke date and type something in the visit notes , then all data from these three fields are recorded in a 'Activities'  journal notes below it and these three fields are emptied . so user can enter multiple meetings . find_real_file.png

find_real_file.png

Questions : 

1)as you see in above image , for 'recorded by' field   i am selecting the user id but  in the visit notes field   it is being saved as sys id and same is stored in  , how do i fix this issue ?

2)can i auto populate the recorded By field with logged in user id ? since there is a client script in the backend to make it mandatory , set display to false if visit notes is empty and  to clear the value .

( my doubt is even thought we set it with logged in user id ,but the line of code from below screen shot  g_form.clearvalue('u_reocrded_by');  will  clear the value i guess )

 

 

find_real_file.png

 

7 REPLIES 7

Tried this too . No luck

Rahul Kumar17
Tera Guru

Hi,

Go The Reference Specification and refer to another table and otherwise set the default value in custom field.

 

Thanq

If my response helped please mark it correct and close the thread.

Thanks,
Rahul Kumar

Yeah , tried already , no luck