Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Copper Contributor
Posts: 69
Registered: ‎05-07-2012

Merge Accounts with Relations to Custom Entities

We do have some custom entities in a saleslogix 7.5.4 environment. When we merge two accounts the problem is, that the accountid of account 'a' in a customentity doesn't get updated with the one from account 'b', account 'a' was merged with.

as a result in the db table there is still the old accountid but the account lookup is empty. That is fact but not the problem.


I tried to add some "merge rules" in Application Architect by adding a "MergeAccount_MoveCustoms".

 

The Code I'm using:

 

public static void MergeAccount_MoveCustoms( IAccount account,  Object mergeProvider, out Boolean result)
        {
            result = UpdatePropertyForEntity(mergeProvider, "CustomEntity", "AccountId");
        }

 

...with the result that I'm getting thrown an error, because the Build process can not find "UpdatePropertyForEntity" because it is located in Sage.SalesLogix.Account.Rules.

 

Is there any chance (adding some AssemblyReference - but witch) to get "UpdatePropertyForEntity" referenced?

Bronze Super Contributor
Posts: 236
Registered: ‎03-30-2009

Re: Merge Accounts with Relations to Custom Entities

Sebastian,

   You need to add a reference to 'Sage.SalesLogix.BusinessRules.dll' and 'Sage.SalesLogix.Services.PotentialMatch.dll' to your business rule in order to use the updateproperty functionality.  You don't need a hint path as these are in the build path already.

 

 

Mike LaSpina
Professional Services Consultant

Sage
8800 N Gainey Center Dr Ste 200
Scottsdale AZ 85258
Tel: 480-383-5344
Cell: 480-321-6637
Fax: 480-556-4090
mike.laspina@sage.com

Your Business in Mind.
Copper Contributor
Posts: 69
Registered: ‎05-07-2012

Re: Merge Accounts with Relations to Custom Entities

Thank you for your response. 'Sage.SalesLogix.Services.PotentialMatch.dll' was the one that was missing.

 

I've tried that, but now it says that it's missing PotentialMatch because it is not in Sage.SalesLogix.Services. But the DLL is existing and I've add it to the assembly references.

Bronze Super Contributor
Posts: 236
Registered: ‎03-30-2009

Re: Merge Accounts with Relations to Custom Entities

Be sure that file exists in the search path.  You may need to copy it to the SalesLogix subfolder of your SalesLogix install (i.e. c:\Program Files\SalesLogix\SalesLogix).  This may be one of the files that is only in the web project and not the SLX install.  Copying it will fix the compilation issue.  The file itself can be found in 'Portal -> Sage SalesLogix -> Support Files ->Bin' of your web project or in the SLXClient/Bin folder of the website after you've deployed.

Mike LaSpina
Professional Services Consultant

Sage
8800 N Gainey Center Dr Ste 200
Scottsdale AZ 85258
Tel: 480-383-5344
Cell: 480-321-6637
Fax: 480-556-4090
mike.laspina@sage.com

Your Business in Mind.
Copper Contributor
Posts: 69
Registered: ‎05-07-2012

Re: Merge Accounts with Relations to Custom Entities

I thought, I'v tried that already. Do I have to restart the Application Architect after copying the file?

Highlighted
Bronze Super Contributor
Posts: 236
Registered: ‎03-30-2009

Re: Merge Accounts with Relations to Custom Entities

I would.  You may also want to try a nuke and pave.

Mike LaSpina
Professional Services Consultant

Sage
8800 N Gainey Center Dr Ste 200
Scottsdale AZ 85258
Tel: 480-383-5344
Cell: 480-321-6637
Fax: 480-556-4090
mike.laspina@sage.com

Your Business in Mind.
Copper Contributor
Posts: 69
Registered: ‎05-07-2012

Re: Merge Accounts with Relations to Custom Entities

it still doesn't work. what am I doing wrong here?

which usings do I need? At the Moment I have

using System;
using Sage.Entity.Interfaces;
using Sage.Form.Interfaces;
using Sage.SalesLogix.API;
using Sage.SalesLogix.BusinessRules;
using Sage.SalesLogix.Services.PotentialMatch;

greatings
Sebastian
Bronze Super Contributor
Posts: 236
Registered: ‎03-30-2009

Re: Merge Accounts with Relations to Custom Entities

I have these usings in my Business Rule.  Note that usings will only affect the amount you have to type - they do no load anything, they just save you some typing:

 

using System;
using Sage.Entity.Interfaces;
using Sage.Form.Interfaces;
using Sage.SalesLogix.API;
using Sage.SalesLogix.Services.PotentialMatch;
using Sage.SalesLogix.BusinessRules;
using System.Collections.Generic;
using Sage.Platform;

 

Also note that intellisense can not always be trusted.

 

Be sure that the file 'Sage.SalesLogix.Services.PotentialMatch.dll' exists in the SalesLogix subfolder of your SalesLogix install directory (ie. C:\Program Files\SalesLogix\SalesLogix).  You can copy this from the bin folder of the deployed site, or the bin folder of the SalesLogix portal support files of your web project.

Mike LaSpina
Professional Services Consultant

Sage
8800 N Gainey Center Dr Ste 200
Scottsdale AZ 85258
Tel: 480-383-5344
Cell: 480-321-6637
Fax: 480-556-4090
mike.laspina@sage.com

Your Business in Mind.
Copper Contributor
Posts: 69
Registered: ‎05-07-2012

Re: Merge Accounts with Relations to Custom Entities

I feel like I'm going crazy

 

#region Usings
using System;
using Sage.Entity.Interfaces;
using Sage.Form.Interfaces;
using Sage.SalesLogix.API;
using Sage.SalesLogix.Services.PotentialMatch;
using Sage.SalesLogix.BusinessRules;
using System.Collections.Generic;
using Sage.Platform;
#endregion Usings

namespace Sage.BusinessRules.CodeSnippets
{
    public static partial class AccountBusinessRules
    {
        public static void MergeAccount_MoveTravelLodgings( IAccount account,  Object mergeProvider, out Boolean result)
        {
            result = UpdatePropertyForEntity(mergeProvider, "TravelLoding", "AccountID"); //Yes, "ID", not "Id"
        }
    }
}

 

It sill doesn't work. No the error is "The name "UpdatePropertyForEntity" does not exist in the current context."

Bronze Super Contributor
Posts: 236
Registered: ‎03-30-2009

Re: Merge Accounts with Relations to Custom Entities

Try the following code:

 

IBusinessRuleHelperService service = new BusinessRuleHelper();
if(service == null)
{
	result = false;
	return;
}

...

service.UpdatePropertyForEntity(entityToChange, whereProperty, targetProperties, propertyValues, entityIds);

 

Note you will have to set the values to use for the parameters.

Mike LaSpina
Professional Services Consultant

Sage
8800 N Gainey Center Dr Ste 200
Scottsdale AZ 85258
Tel: 480-383-5344
Cell: 480-321-6637
Fax: 480-556-4090
mike.laspina@sage.com

Your Business in Mind.