05-07-2012 08:20 AM
hello,
when performing a contact merge, records in the AccountProduct table are not updated with the "primary" contactID from the merge operation. I have a couple of questions regarding this.
1. Is the SLX merge capabilities updateable or is this built in SLX code?
2. If the answer to number 1 is yes, how do I find this code?
3. If the answer is no, are there any workarounds?
thanks for you help!!!
Dan
Solved! Go to Solution.
05-07-2012 08:54 AM
To answer:
1 - "Mereg" is not customizable - it is what we call "hard code" in the Saleslogix exe/dll's and teh source is NOT available to anyone - not even BP's.. never has been.
2 - Of course... see 1 above ;-)
3 - You could build your own merge from scratch.. OR just build out a custom "tool" that you run "post merge" to fix up the loose ends.
05-07-2012 11:18 AM
hi RJLedger,
Thanks for the helpful response!!
What about "capturing" the contact merge event, perform merge operations that the built in merge is missing, then pass control back over to the buil in merge.
Does this sound doable?
Is there an easier approach?
thanks!
Dan
05-07-2012 12:11 PM
Hi Dan,
Just to make sure I gave you a correct response.. I just took a quick look at the Global (event handler) VBScripts to see if you can catch the event() needed to do this.. and the quick answer is ... maybe you can create a custom "OnBeforeFunctionExecute_....function name..." and an OnAfterFunctionExecute_...function name.." to trap it... maybe.. but you need to do a bit of experimenting of course.
05-07-2012 12:15 PM
thanks RJLedger!
I will try it out!!
Dan
06-06-2012 05:10 AM
I discovered this issue recently and opened a ticket with Sage support. I agree with RJLedger - you can trap the Merge Records function before and after it executes and examine the IDs affected; from there you can fix related records.
Here is my resolution if you're still struggling with this:
- see http://customerfx.com/pages/saleslogix-answers/2011/06/09/Adding-Custom-Code-to-the-Merge-Records-Fu... - this post tells how to create a vbScript that runs in place of the Merge Records function. You can then
use this code to locate the record IDs being passed to MergeRecords.
dim idList , x
' This generates a list of IDs that were sent into the merge.
for x = 0 to application.MainViews.ActiveView.GroupsPane.Selection.Count - 1
idList = idList & application.MainViews.ActiveView.GroupsPane.Selection.Item(x) & ","
next
msgbox idlist
Application.Basicfunctions.DoInvoke "Function","MainViewupMerge"
Note that you can run code after the DoInvoke as well - control returns here after the merge completes.
What I also learned is that the Check for Duplicates and Purge Records tools can also cause the same issue, but since they operate on large numbers of records, there's no way to figure out what actions they took.
Has anyone written a replacement Check for Duplicates as an Active Form or Script? That looks like the only way to really resolve this issue.
06-08-2012 07:44 AM
hi DaleWarner,
thanks a lot for your post! It was the missing piece of the puzzle for me!
Below is exactly what I did.
1. Create a VBScript file with a Sub Main function. the file is called C_ContactMergeHelper stored in System.
2. Open System->Contact Details form, click on GroupsPane and then select view->properties-PopupMenu and select Merge Records option. Change Action to ActiveScript and Argument to System:C_ContactMergeHelper
3. Contents of C_ContactMergeHelper:
Sub Main() for x = 0 to application.MainViews.ActiveView.GroupsPane.Selection.Count - 1 redim preserve contactIDs(x + 1) redim preserve contactNames(x + 1) contactIDs(x) = application.MainViews.ActiveView.GroupsPane.Selection.Item(x) contactNames(x) = GetContactName(contactIDs(x)) next Application.Basicfunctions.DoInvoke "Function","MainView:DupMerge" sqlCondition = "CONTACTID in (" For Each contactID In contactIDs if contactID <> "" then sqlCondition = sqlCondition & "'" & contactID & "'," end if Next sqlCondition = Left(sqlCondition,len(sqlCondition) - 1) & ")" contactIDCountPostMerge = GetField("COUNT(CONTACTID)", "CONTACT", sqlCondition) 'if the Merge was not canceled and it was successful, there should only be one 'contactID (primary) still in existance in the Contact table if(contactIDCountPostMerge = 1) then primaryContactID = GetField("CONTACTID", "CONTACT", sqlCondition) accountID = GetField("ACCOUNTID", "CONTACT", "CONTACTID = '" & primaryContactID & "'") x = 0 For Each contactID In contactIDs if contactID <> "" and contactID <> primaryContactID then 'do what you need to here end if x = x + 1 Next end if
thanks
Dan
06-08-2012 11:57 AM
Glad it was of value to you.
Now if you figure out what to do with Tools / Maintenance / Check for Duplicates ... let me know!