You are here:
Create and Deploy Mappings for Automotive Lead Management
Convert lead line items into opportunity line items and lead preferred sellers into opportunity preferred sellers automatically when you convert a lead into an opportunity. For custom fields ad additional attributes, use the ObjectHierarchyRelationship metadata API to create and deploy field mappings.
Required Editions
| Available in: Enterprise, Unlimited, and Developer Editions. |
| User Permissions Needed | |
|---|---|
| To create object hierarchy relationship mappings: | System Administrator |
Make sure the Partner Lead Management Default Mappings feature is enabled in your org. To learn which fields get automatically mapped, see Manage Opportunity Products and Preferred Sellers.
-
Create a mapping file for source-to-target object field mappings:
Parent-to-parent mapping is used to convert Lead Line Item to Opportunity Line Item and Lead Preferred Seller to Opportunity Preferred Seller. . In this example, we are mapping the Product Category and Price Type fields from Lead Line Item to the Opportunity Line Item object. For this, we’ve created the custom fields Category and Price Type on the Opportunity Line Item object.
Lead Line Item to Opportunity Line Item mapping:
<?xml version="1.0" encoding="UTF-8"?> <ObjectHierarchyRelationship xmlns="http://soap.sforce.com/2006/04/metadata"> <parentObjectMapping> <inputObject>LeadLineItem</inputObject> <outputObject>OpportunityLineItem</outputObject> <mappingFields> <inputField>ProductCategory</inputField> <outputField>Category</outputField> </mappingFields> <mappingFields> <inputField>PriceType</inputField> <outputField>PriceType</outputField> </mappingFields> </parentObjectMapping> <outputPntRelationshipFieldName/> <inputObjRecordsGrpFieldName></inputObjRecordsGrpFieldName> <parentRecord/> <mappingType>ParentToParent</mappingType> <usageType>TransformationMapping</usageType> </ObjectHierarchyRelationship>
Note Ensure that the value of the Usage Type field in a component file is TransformationMapping. -
If your org is multicurrency enabled, add the following mappings:
<mappingFields> <inputField>CurrencyIsoCode</inputField> <outputField>CurrencyIsoCode</outputField> </mappingFields> -
Create a package.xml file, and then store the file in the ObjectHierarchyRelationship
folder.
The package.xml file defines the API version of your instance and the metadata type. Here’s a sample package.xml file:
<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <types> <members>*</members> <name>ObjectHierarchyRelationship</name> </types> <version>56</version> </Package> -
Structure the folder that contains the mapping file and the package.xml file.
Here’s a sample package structure:
ObjectHierarchyRelationship ObjectHierarchyRelationship.settings package.xml -
To deploy the package, make the
deploy ()API call via an API tool, such as Postman.When the user converts a lead to an opportunity, the lead line items and lead preferred sellers are automatically also converted into opportunity line items and opportunity preferred sellers. The field mappings are successfully deployed during the conversion. The/connect/manufacturing/transformationsAPI behind the scenes successfully executes the conversion of these child records.

