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 :
Dynamics 365 Community / Blogs / Day to Day Dynamics 365 / Dynamics 365: How to displa...

Dynamics 365: How to display a Lead as either a company or a person

apa Profile Picture apa 8,284 Moderator

Tested on:
Dynamics 365 version 9.0


By default a Lead's name contains data from the Lead form's First Name and Last Name fields. Companies can have business needs to display leads as companies as opposed to persons however out of the box Dynamics 365 doesn't really provide a good way of doing this. With some fairly easy customization a Lead can be displayed as either a company or a person. This blog post walks you thought the steps of customizing your Dynamics 365 to accomplish this.

1050.1.png


Displaying a Lead as either a company or a person

To change a Lead's name to a company or a person, we need to create three new custom fields, a Business Rule and edit field mappings.

1. Edit the out of the box field firstname on the Lead entity and set its Display Name to First Name (OLD). Set the field's Field Requirement to Optional.

2. Edit the out of the box field lastname on the Lead entity and set its Display Name to Last Name (OLD). Set the field's Field Requirement to Optional.

3. Create two new custom fields on the Lead entity. Name one of the fields as First Name and the other as Last Name. Be sure to set the Maximum Length to max 50 characters. This is to make sure field mappings work in the steps to follow.

4. Create a new custom field Lead Type on the Lead entity. Set Data Type as Two Options and name the options Person and Company.

5. Remove the field fullname (its Display Name is Name) from the form.

6. Add the three new custom fields First Name, Last Name and Lead Type on the form. Also add the out of the box fields First Name (OLD) and Last Name (OLD) on the form and hide them (uncheck the box Visible by default).

Lead-form.png
Out of the box Main form of the Lead entity on the left and customized Main form on the right.

7. Create a new Business Rule according to the photos below and set the scope to match the form you are customizing or to All Forms. The Business Rule will contain the logic behind what happens when Lead Type (step 4) is selected.

Set-Lead-as-company-or-person.png

Business-Rule.png


8.
Activate the Business Rule and publish all customizations.

9. Navigate to 1:N Relationships on the Lead entity and open contact_originating_lead. Click on Mappings and delete mappings firstname and lastname.

5287.4.png


10.
Add new mappings to this same contact_originating_lead (Lead to Contact) relationship by clicking on "New". Use the new fields First Name and Last Name that were created in step 3 and map them to the Contact entity's firstname and lastname fields. Make sure the field lengths in the source and target are equal or that the target is greater in length than the source. The importance of field length was pointed out in step 3. Microsoft has good documentation on mapping entity fields so be sure the check it out if needed.

3554.5.png

8535.6.png


The outcome should look similar to the photo below. Naturally your custom fields may have different names than mine.

3438.7.png


11.
Publish all customizations.


Testing the customized Lead form

After all the customizations it's time to test the Lead form. Let's start by confirming that switching Lead Type between Person and Company changes the respective fields to Business Required or Not Business Required.

Lead Type = Person -> First Name and Last Name are Business Required.

Lead Type = Company -> Company is Business Required.

2043.8.png

6735.9.png


Next let's save the Lead when the Lead Type is set to Person. The first name and last name are correctly displayed as the name of the Lead. Qualifying the Lead creates an Opportunity and a Contact is also created correctly. Company field was not filled so an Account is not created.

4643.10.png

0020.11.png


Next let's test creating a Lead that has Lead Type set to Company. The company name is correctly displayed when saving the form and qualifying the Lead creates an Opportunity without a Contact as First Name and Last Name were not filled.

4812.12.png

8715.13.png


Two more tests to do:

- Set Lead Type to Person and fill First Name, Last Name and Company. Save the form and qualify the Lead.
- Set Lead Type to Company and fill First Name, Last Name and Company. Save the form and qualify the Lead.

Both options work so we can conclude that the customizations work as intended.

3617.14.png

15.png

16.png

17.png


I hope these instructions enable you to take more out of Leads in your sales process.


Disclaimer: 
All my blog posts reflect my personal opinions and findings unless otherwise stated.

Comments

*This post is locked for comments