How to specify the server value for email account creation for gmail

NVSN
Tera Contributor

Hi Guru,

Hope this finds you well,

 

How to specify the server value for email account creation. I am using the gmail site for testing.

 

Kindly find the attached screen shot, highlighted the required field to update..

 

Email Account.PNG

Thanks in advance for time & help.

5 REPLIES 5

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @NVSN ,

 

You will need to create a onchange client script like below to parse the email and push the domain name to the 'server' field.

 

function onChangeEmail() {
    var email = g_form.getValue('email');
    var domain = '';

      if (email) {
        var atIndex = email.indexOf('@');
        if (atIndex !== -1) {
            domain = email.substring(atIndex + 1);
        }
    }

    g_form.setValue('u_server', domain); 
}

 

I hope this helps.. you can also do this with array and split function...


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Community Alums
Not applicable

Hi @NVSN ,

I tried your problem in my PDI and it works for me 

Please check the below code this will work for you

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

    //Type appropriate comment here, and begin script below
    var email = newValue;
    var server = email.indexOf('@');
    var serverName = '';
    serverName = email.substring(server + 1);
    var onlyServerName = serverName.split('.')
    alert(onlyServerName[0])

	g_form.setValue('u_server', onlyServerName[0]);

}

 

Result 

SarthakKashya2_0-1714300909738.png

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak

 

Hi @Community Alums ,

This is working for user table, but my concern is for email accounts.

Kindly check.

 

Thanks.

 

Community Alums
Not applicable

Hi @NVSN ,

By email account you mean that gmail na the domain name ? 

You want that domain name in server field correct ? 

Can you please provide me your code may be I'll fix that

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak