web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Creating Parent Contact From Lead - Search Term Entered as Contact's Last Name

(0) ShareShare
ReportReport
Posted on by 412

Hi, I can't find any other forum post about this, so I'm not sure if this is just affecting us.

When we try to create a new parent contact from a lead, the term we search for is entered into the Quick Create form as the last name.

We have a relationship between Lead and Contact which maps the first and last name. It appears the first name is mapped into the first name field in the Quick Create form, but the term we search for (normally the full name) is entered into the last name field of the Quick Create form. See the screenshots below.

Lead information:

4606.lead.png

Search term:

8865.search.png

Quick Create form (first name from Lead, last name from search term):

quickcreate.png

Does anyone know whether this is something we can fix? I assume it's Dynamics trying to help by saving us entering information automatically, but in this case, the functionality doesn't work.

Thanks!
Stephen

I have the same question (0)
  • LuHao Profile Picture
    40,890 on at
    RE: Creating Parent Contact From Lead - Search Term Entered as Contact's Last Name

    Hi Stephen,

    We need to check the mappings of the relationship between Lead and Contact.

    Go to Settings > Customizations > Customize the System, expand Entities > Contact > 1:N relationships, edit lead_parent_contact.

    pastedimage1605517004272v1.png

    Click Mappings, check if there is a mapping of lastname and lastname.

    pastedimage1605517192698v2.png

  • Stephen Pryke Profile Picture
    412 on at
    RE: Creating Parent Contact From Lead - Search Term Entered as Contact's Last Name

    Hi Lu Hao,

    Thanks for the answer. Yep, the mapping is there already. In fact, if you leave the search box blank and just click "New Contact", then both the first and last name are taken across into the quick create form.

    It's almost like there is a mapping between the lookup field search box and the last name field on the quick create form, but I've no idea where that would be defined.

    Cheers,

    Stephen

  • LuHao Profile Picture
    40,890 on at
    RE: Creating Parent Contact From Lead - Search Term Entered as Contact's Last Name

    Hi Stephen,

    Then we can check if there is any OnLoad event in the Contact quick create form.

    pastedimage1605518971125v1.png

    pastedimage1605518984616v2.png

    pastedimage1605519015987v3.png

    If so, disable the OnLoad event.

  • Stephen Pryke Profile Picture
    412 on at
    RE: Creating Parent Contact From Lead - Search Term Entered as Contact's Last Name

    Hi again Hao,

    Thanks for the tip, but unfortunately once more this isn't the case. There is no OnLoad event set on the contact quick create form.

    If you have any further ideas, I'd be extremely grateful!

    Do you get the same thing happening in your environment? The search term being mapped to the last name on the contact?

    Cheers,

    Stephen

  • LuHao Profile Picture
    40,890 on at
    RE: Creating Parent Contact From Lead - Search Term Entered as Contact's Last Name

    Hi Stephen,

    It is not happening in my environmnet.

    Please check if Last Name field of the Contact quick create form is a custom field.

    pastedimage1605582941287v1.png

  • Stephen Pryke Profile Picture
    412 on at
    RE: Creating Parent Contact From Lead - Search Term Entered as Contact's Last Name

    Hi Hao,

    No - it's the default MS field:

    lastname.png

  • Verified answer
    LuHao Profile Picture
    40,890 on at
    RE: Creating Parent Contact From Lead - Search Term Entered as Contact's Last Name

    Hi Stephen,

    Sorry that I misunderstood your question. Yes, it also happened in my environment.

    In fact, this is by design.

    pastedimage1605603507229v2.png

    pastedimage1605603488034v1.png

    When you enter anything in the lookup field, and then click New, the content you entered will be automatically filled in the Name field.

    For Contact, it will automatically fill the content of the lookup field into the Last Name field, which is by design.

    In addition, to solve this problem, the only solution is to add an OnLoad event to the Contact quick creation form, which requires Javascript. Do you have Javascript experience?

  • Stephen Pryke Profile Picture
    412 on at
    RE: Creating Parent Contact From Lead - Search Term Entered as Contact's Last Name

    Ok, good to have confirmation that this is how it should be!

    I'll have a play around with javascript and see what I can do.

    Thanks for all your help!

    Stephen

  • Suggested answer
    LuHao Profile Picture
    40,890 on at
    RE: Creating Parent Contact From Lead - Search Term Entered as Contact's Last Name

    Hi Stephen,

    We will create a web resource of Javascript. The code is as follow.

    function splitLastName(executionContext)
    {
    	var formContext = executionContext.getFormContext();
    
    	var fullName = formContext.getAttribute("lastname").getValue();
    	var arr = fullName.split(" ");
    	var lastName = arr[arr.length-1];
    
    	formContext.getAttribute("lastname").setValue(lastName);
    }

    Then add an OnLoad with the new web resource for Contact quick create form, set the function to splitLastName.

    pastedimage1605667912545v1.png

    pastedimage1605667927079v2.png

    This way, when we new an Existing Contact from Lead and there is a name in the lookup field, the Last Name field of Contact quick create form will only contain the last name instead of the name we entered in the lookup field.

    The function of the OnLoad event is to divide the name in the lookup field by spaces and take only the last word.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 235

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 177

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 156 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans