We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

setting logged username by using client script

Not applicable

Hello folks ,

I have a field name called "user" this field is referenced to "sys_user" table . Now i would like to write a client script to setValue default logged user name in this field .

Is there any way to set the value by using client scripts ? Because when i try to write   below script is hitting error .

function onLoad() {

   

var uval = g_form.getValue('req_by_for_requested_by') ;

if (uval == '')

{

var user = ga.addQuery('user_name',gs.getUserName());

g_form.setValue(user) ;

//alert(uval);

}

}

1 ACCEPTED SOLUTION

Deepak Kumar5
Kilo Sage
  1. function onLoad() {  
  2.        
  3. var uval = g_form.getValue('req_by_for_requested_by') ;  
  4. if (uval == '')  
  5. {  
  6. g_form.setValue('user',g_user.userID) ;    
  7. //alert(uval);  
  8. }  
  9. }

View solution in original post

5 REPLIES 5

BHUSHAN KEWAT
Tera Contributor
  • Use this script:

function onLoad() {  

g_form.setValue('user', g_user.userID) ;    

 }