How to Auto fill "Display Name" Field.

Chaitanya Redd1
Tera Guru

I have created a form in that I have added few fields in that I have created "Account" , "Display Name" & "Name" Fields.

In this I need help whenever I request new project I will select "Account" field and fill " Name" Fields. So, here I need to automatically "Display Name" filed has to fill Example : " Account - Name" fields values in Display Name filed.

find_real_file.png

find_real_file.png

Please help the field values has to be in this sequence in Display Name Filed :  " Account - Name"

 

1 ACCEPTED SOLUTION

try this code :

 is backed name of name field "short_description" ??

is yes then :

   var account= g_form.getReference("u_account").short_description;
    var name= g_form.getValue("short_description");
   
  
   
        var displayName = account +"-"+name;
   
    g_form.setValue("u_display_name",displayName);

 

===================================== 

but if  backend name of "name" field is another then:

   var account= g_form.getReference("u_account").short_description;
    var name= g_form.getValue("backend name of name field"); 
   
  
   
        var displayName = account +"-"+name;
   
    g_form.setValue("u_display_name",displayName);

View solution in original post

10 REPLIES 10

Harish Vaibhare
Kilo Guru

Hi Jry,

Do you want that "display name" should be auto populated when account value is selected ?

 

if yes then write below code in >> onChange Client script.

 

var account= g_form.getReference("account",fun);

function fun()

{

 g_form.setValue("display_name",account.display_value); 

//account.display_value is value in account table for display name

}

 

Kindly mark helpful and correct if it works.

Thanks

Not only account value I need name field values also be auto populated.

 

Example : If I select any account in account field and type/fill any values in name field 

                 Account : Apple - Sales management

                   Name : Request 123456 update project apple.

then as shown below has to auto populate

             Display Name : Apple - Request 123456 update project apple

write onChange Client script >> on Name field

and write below code:

   
    var account= g_form.getReference("account").name;
    var name= g_form.getValue("name");
    
    
    
        var displayName = account +"-"+ name;
    
    g_form.setValue("u_emp_sal",displayName);

 

Thanks.

I have tried it showing error

function onChange() {
     var account= g_form.getReference("u_account").short_description;
    var name= g_form.getValue("short_description");
   
   
   
        var displayName = u_account +"-"+ short_description;
   
    g_form.setValue(u_display_name);
}