Breaking Change on the LeadSearchAndConvert.ascx.cs file in Infor CRM 8.3x

Breaking Campaign Target Logic
In older version of the custom smart part LeadSearchAndConvert, there is code in the ConvertLeadToNewAccountAndContact method that converts lead campaign target data into the newly created contact record.
In older version this code look like:

        IList<ICampaignTarget> campaignTargets = EntityFactory.GetRepository<ICampaignTarget>().FindByProperty("EntityId", lead.Id.ToString());
        foreach (ICampaignTarget campaignTarget in campaignTargets)
            lead.ChangeCampaignTargetEntityID(contact, campaignTarget);

In 8.3 that Lead business rule no longer exists. Instead there is a new method in the ICampaignTarget entity. Now that section of code looks like:

        IList<ICampaignTarget> campaignTargets = EntityFactory.GetRepository<ICampaignTarget>().FindByProperty("EntityId", lead.Id.ToString());
        foreach (ICampaignTarget campaignTarget in campaignTargets)
			campaignTarget.ChangeEntityId(contact);

In the ConvertLeadToContact method there is also code that converts lead campaign target data into the newly created contact record, like in the ConvertLeadToNewAccountAndContact method.

                foreach (IAttachment attach in attachment)
                    sourceLead.AddAttachmentsContactID(contact, account, null, attach);

Again, in 8.3 that Lead business rule no longer exists. Instead there is a new method in the ICampaignTarget entity. Now that section of code looks like:

                foreach (IAttachment attach in attachment)
                    attach.AddContactId(contact, account, null);

Breaking Attachment Logic
Also, in the ConvertLeadToContact method there is code that takes attachments from the lead record and moves them to the newly create Contact record.

In older version this code looked like:

                foreach (IAttachment attach in attachment)
                    sourceLead.AddAttachmentsContactID(contact, account, null, attach);

In 8.3 that Lead business rule no longer exists. Instead there is a new method in the IAttachment entity. Now that section of code looks like:

                foreach (IAttachment attach in attachment)
                    attach.AddContactId(contact, account, null);

There is also similar logic in the AddAttachmentsToLead method.

    private void AddAttachmentsToLead(ILead sourceLead, IAccount account, IContact contact, IOpportunity opportunity)
    {
        IList<IAttachment> attachments = EntityFactory.GetRepository<IAttachment>().FindByProperty("LeadId", sourceLead.Id.ToString());
        foreach (IAttachment attachment in attachments)
            sourceLead.AddAttachmentsContactID(contact, account, opportunity, attachment);
    }

Now needs to be

    private void AddAttachmentsToLead(ILead sourceLead, IAccount account, IContact contact, IOpportunity opportunity)
    {
        IList<IAttachment> attachments = EntityFactory.GetRepository<IAttachment>().FindByProperty("LeadId", sourceLead.Id.ToString());
        foreach (IAttachment attachment in attachments)
            attachment.AddContactId(contact, account, opportunity);
    }

Just Plain Breaking to Break Logic
Finally, the the MergeRecords method, there is a call made to a Lead business rule.
In older versions this rule was named “ManualMergeLeadwithLead” in 8.3 this rule is now named “ManualMergeLeadWithLead” (capital W in the name).
And just as a final bonus that MergeRecords method also contains the attachment and campaign target code change requirements detailed above.

The result of this is if you bring over your previously customized ConvertLeadToNewAccountAndContact.ascx.cs file you will get an error like this in the web client:

‘~/SmartParts/Lead/LeadSearchAndConvert.ascx’ could not be loaded [Saleslogix Error Id=SLXE348A4029B757BD2]
System.Web.HttpCompileException (0x80004005): d:\Saleslogix\Inetpub\wwwroot\SlxClient\SmartParts\Lead\LeadSearchAndConvert.ascx.cs(919): error CS1061: ‘Sage.Entity.Interfaces.ILead’ does not contain a definition for ‘ChangeCampaignTargetEntityID’ and no extension method ‘ChangeCampaignTargetEntityID’ accepting a first argument of type ‘Sage.Entity.Interfaces.ILead’ could be found (are you missing a using directive or an assembly reference?)

or

‘~/SmartParts/Lead/LeadSearchAndConvert.ascx’ could not be loaded [Saleslogix Error Id=SLXE348A4029B757BD2]
System.Web.HttpCompileException (0x80004005): d:\Saleslogix\Inetpub\wwwroot\SlxClient\SmartParts\Lead\LeadSearchAndConvert.ascx.cs(1015): error CS1061: ‘Sage.Entity.Interfaces.ILead’ does not contain a definition for ‘AddAttachmentsContactID’ and no extension method ‘AddAttachmentsContactID’ accepting a first argument of type ‘Sage.Entity.Interfaces.ILead’ could be found (are you missing a using directive or an assembly reference?)

This kind of thing really frustrates us as Business Partners and our clients. Why make such breaking changes, and why are they not documented??

Come on Infor.

ABOUT THE AUTHOR

Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!