merging records in Skuid

  • 1
  • Question
  • Updated 3 years ago
  • Answered
Maybe this discussion is already out there, but it's hard to search because of all the stuff about merge syntax...

I'd like to merge Contacts on an Account. Salesforce has this functionality natively, how do we do it with Skuid?
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
Figured it out:

When you click Merge Contacts in regular salesforce, you get: /merge/conmergewizard.jsp?retURL=%2F001E000001EAK2s%3Fnooverride%3D1%26sfdc.override%3D1&id=001E000001EAK2s

If you paste this in a Skuid button Redirect to URL, and take off the last id param values and replace with an Account ID, you'll be in business:

/merge/conmergewizard.jsp?retURL=%2F{{{AccountIdField}}}%3Fnooverride%3D1%26sfdc.override%3D1&id={{{AccountIdField}}}
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Nice work, Jack!
Photo of Erik Wahlberg

Erik Wahlberg

  • 2,156 Points 2k badge 2x thumb
Best way to not have to rebuild SF components, redirect to them! Great for converting Leads as well
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Great Work.  Having said that - if you don't want to see that Aloha UI,  you can create a merge function within Skuid.  You create one model for all contacts you want to merge.  Then create models for all the child records you want to reparent. (Tasks, Notes, etc).  A button on the contact table does several things using the action framework:  

- A model condition on contact is activated so that the "Winner" contact is loaded. 
- The opposite model condition is activate on another model to identify the "losers"
- Models are created that retrieve related object records where the "WhatId" is in the original list of contacts.  The WhatId is updated with the ID from the winner.
- You might want to implement some UI to compare field values on the contact directly to allow users to choose the winner.  With some javascript you could have "on click" in one of the fields update the value in the "winner" record.
- Finally you want to delete all the rows in the "Loser" model.  (this really just puts them in the recycle bin,  so you can undo your actions,  but that's what merging does...)

Weve sketched out Lead Deduping with this method and have been able to dedupe dozens of leads at a time.  The product is not finished yet, but is well on its way.

I think that is all the functionaliy that is associated with Merging.  Am I missing anything?  I'd love your feedback. 
(Edited)
Photo of Samuel Cohen

Samuel Cohen

  • 332 Points 250 badge 2x thumb
Rob - this seems really helpful - I'm trying to implement a merge feature now so we don't have to send users out of the Skuid UI. Can you share your code you used here, even if it's in draft form?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Yes Sam. I'll try to grab that code and standardize it so it can be shared.  Its been really successful with our lead reps.. 
Photo of Samuel Cohen

Samuel Cohen

  • 332 Points 250 badge 2x thumb
Thank you!
Photo of Andrew Hess

Andrew Hess

  • 262 Points 250 badge 2x thumb
Any idea why this wouldn't work as a Global Action on a table? I have it working as a page title button, but I don't want to include a page title in the page.
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
Should work just fine. My understanding is global actions behave exactly like page title buttons.
Photo of Andrew Hess

Andrew Hess

  • 262 Points 250 badge 2x thumb
That's my understanding. I think the problem comes from the page being embedded as a VF page on the Account page layout. The skuid page is a related contacts list.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Global action buttons should work on a skuid page no matter where the page is embedded. If your code is working as a pagetitle but not a global action, you might want to check for differences in context or arguments.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Andrew - make sure that the table and the page title are bound to the same model.  If they are not - you will need to find the merge data in the URL either from the Table's model (where it may not just be {{RecordId}} but may be {{RelatedObject__c}}.   Or you will need to use global merge syntax to pass the value from the Page Title's model into the url redirect code.