Merge Input of the Fields into an other Field

Hello everyone,

i've a problem to merge to fields (pers_firstname, pers_lastname) into a new field pers_completename

When a user add a new person or edit a person the field pers_complete name should be filled automatically.

I am really new to the CRM Community and coding in the CRM so i hope you could help me to solve this problem.

kind regards from germany

  • 0

    Dear Oliver,

    From your above post we understand you want to concatenate Person First name and last name into new field pers_completename.

    You can achieve above requirement using Client side (on change script) and server side scripting (Table level script).

    Client Side Scripting:

    1. Add Person Complete name field on PersonBoxLong screen.
    2. Add below Javascript code onto Custom Content of PersonBoxLong screen.

    $(document).ready(function(){

    MergePersonName();

    });

    function MergePersonName(){

    $("#pers_completename").val($("#pers_firstname").val() +' '+ $("#pers_lastname").val())

    }

    3.Call below Javascript function onto OnChangeScript of “Pers_Firstname” and “Pers_Lastname”.

    MergePersonName();


    Server Side Scripting:

    1. Create new TLS in Person entity.
    2. Add below snippet code in InsertRecord() and UpdateRecord() TLS functions.

    var sFirstname=new String(Values("pers_firstname"));

    if(sFirstname=="" || sFirstname=="null" || sFirstname=="undefined")sFirstname="";

    var sLastName=new String(Values("pers_lastname"));

    if(sLastName=="" || sLastName=="null" ||sLastName=="undefined")sLastName="";

    Values("pers_completename") = sFirstname +" "+ sLastName ;

    Hope this information helps!

    Regards,

    Dinesh

  • 0

    Hello Greytrix,

    thank you very much it helped me alot.