Move note field over from Lead?


  • Hey all,


    I think this question might have been done to death but is it possible to transfer my notes field from leads to opportunity?  I came accross the following instructions:-


    1. Click to Customize Entities 2. Double click to edit the Opportunity entity 3. Click to view the list of '1:N Relationships' that the Opportunity entity has. This will present a list of all the relationships from the Opportunity entity to other entities in your MSCRM environment. 4. Double click to edit the Relationship titled 'opportunity_originating_lead' where the Primary Entity is 'Lead' and the Related Entity is 'Opportunity' 5. This will bring up a new window detailing the values of the Opportunity to Lead relationship - from here, you can click to view the list of 'Mappings' that this relationship has. 6. This list of Mappings defines all the fields which are mapped from the original Lead record to the new Opportunity record when the Lead is qualified. So from here you can add new Mappings to denote that the value of Field A on the Lead is copied into Field B on the Opportunity when qualified. 7. Click the 'New' button to add a completely new mapping, a smaller dialogue will be presented showing a list of all the Lead fields on the left-hand side and a similar list of all the Opportunity fields on the right-hand side. Here you can select one of the Lead fields and one of the Opportunity fields to define the new Mapping. So in this case, select out the Lead Source fields on each entity and then hit 'OK'. The mapping is now added to the list of fields to be copied on Lead qualification. 8. Save and Close all the sub-windows opened, and then hit 'More Actions' and then 'Publish All Customisations' in the original Customize Entities window from step 1. This will publish out the changes made to the Mappings and now when you convert a Lead to Opportunity you should notice your mapping in place and so the Lead Source copying from Lead to Opportunity. NOTE: When creating a Mapping between two picklists, the picklist values must match so that Option 1 in the Lead Picklist matches Option 1 in the Opportunity Picklist, otherwise copying the value will be inconsistent. This is very long-winded to describe in a post and is much quicker than this suggests, particularly once you know your way round the customisations section of CRM. Hope that helps, this concept of adding or removing Mappings also applies for converting Leads into Accounts or Contacts in the same way.


    However there is No note field?  I've also read somewhere the only way t do this is to create a plug in?  is this true?

    Wednesday, January 12, 2011 12:39 PM


All replies

  • The approach you've suggested doesn't work because Note is an entity, not a field. There is a 1:N relationship between Lead and Note.

    Here's a blog article with three suggested approaches to achieving your requirement:

    Regards, Neil

    Neil Benson, CRM Addict and MVP at Customery Ltd. You can reach me on LinkedIn or Twitter. Join over 10,000 other CRM professionals on the Microsoft Dynamics CRM group on LinkedIn.

    • Marked as answer by HAI1985 Wednesday, January 12, 2011 4:27 PM
    Wednesday, January 12, 2011 1:20 PM
  • Yes you must write a plugin like,

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Crm.Sdk;
    using Microsoft.Crm.SdkTypeProxy;
    using Microsoft.Crm.Sdk.Query;
    namespace MaptoNotesFromLeadToOp
    public class ConvertNode : IPlugin
    public void Execute(IPluginExecutionContext context)
    if (context.MessageName == MessageName.Create &&
    context.InputParameters.Contains("Target") &&
    context.InputParameters["Target"] is DynamicEntity)
    DynamicEntity entity = (DynamicEntity)context.InputParameters["Target"];
    //Check that target entity is contact
    if (entity.Name != EntityName.opportunity.ToString())
    if (entity.Properties.Contains("originatingleadid"))
        Guid OppId = (Guid)context.OutputParameters["Id"];
        Guid leadid = ((Lookup)entity["originatingleadid"]).Value;
        CrmAuthenticationToken token = new CrmAuthenticationToken();
        token.AuthenticationType = AuthenticationType.AD;
        token.OrganizationName = context.OrganizationName;
        CrmService crmservice = new CrmService();
        crmservice.UseDefaultCredentials = true;
        crmservice.Url = "http://<Server name>/MSCrmServices/2007/CrmServiceWsdl.aspx";
        crmservice.CrmAuthenticationTokenValue = token;

        QueryByAttribute query = new QueryByAttribute();
        query.ColumnSet = new AllColumns();
        query.EntityName = EntityName.annotation.ToString();
        query.Attributes = new string[] { "objectid" };
        query.Values = new object[] { leadid };
        RetrieveMultipleRequest request = new RetrieveMultipleRequest();
        request.Query = query;
        request.ReturnDynamicEntities = false;
        RetrieveMultipleResponse response = (RetrieveMultipleResponse)crmservice.Execute(request);
        foreach (annotation note in response.BusinessEntityCollection.BusinessEntities)
            note.objectid = new Lookup(EntityName.opportunity.ToString(), OppId);
            note.objecttypecode = new EntityNameReference(EntityName.opportunity.ToString());



    Wednesday, January 12, 2011 2:25 PM
  • Thanks
    Wednesday, January 12, 2011 4:51 PM