You need to sign in to do that
Don't have an account?
Christian Schwabe 9
LWC: Custom component merge custom and standard objects
Hello everyone,
i try to build a custom lightning web component for a generic way to merge custom and standardobjects like the standard merge functionality for account, contact and leads.
Therefore i built two lwcs:
https://ibb.co/gwp1fRk (https://ibb.co/jMRKJZL)
The first lwc (german language) show the salesforce standard "potential duplicates" component.
Below that - the highlighted one is my custom lwc.
The first screen (step1) looks like the following (Unfortunately I can't upload images - sorry for that):
https://ibb.co/MkJmmZT
After the selection and click on "Next" second screen (step2) appears and looks like the follwing:
https://ibb.co/xXQZDV1
On screen2 you have to choose the masterrecord and fields which has to move to masterrecord.
For comparison: In the standard potential duplicates the screen for step2 looks like the following:
https://ibb.co/5x7hfFv
I want to do this the exact same way. Here comes my problem: I didn't find a structure provided by apexcontroller that is able to iterate in a way to this list that columns and rows are syncron. The prepared structure of (selected) data records should be combined in such a way that they can be passed on to an apex controller, which then takes over the merge process.
One of my various solutions provide the following structure: Map<Id, List<Map<String, String>>>. Where key of map is the record id. The value of the outer map is a list with a map (key: apiname, value: fieldvalue). But this structure does not fit to the columns of screen2 and you can't iterate over map. Also a template expression doesn't allow NumericLiteral to access a specific index or key. It seems like everything has to be a list.
If I can realize this list of the selection, the processing of the data sets in Apex is only a child's play. Today I have worried all day about it and have not found an adequate solution.
Any suggestions for a provided structure of objects, arrays, maps to rule this target?
After i finished that components and everything works fine I am willing to publish the corresponding components.
i try to build a custom lightning web component for a generic way to merge custom and standardobjects like the standard merge functionality for account, contact and leads.
Therefore i built two lwcs:
- potentialDuplicates
- mergeDuplicates
https://ibb.co/gwp1fRk (https://ibb.co/jMRKJZL)
The first lwc (german language) show the salesforce standard "potential duplicates" component.
Below that - the highlighted one is my custom lwc.
The first screen (step1) looks like the following (Unfortunately I can't upload images - sorry for that):
https://ibb.co/MkJmmZT
After the selection and click on "Next" second screen (step2) appears and looks like the follwing:
https://ibb.co/xXQZDV1
On screen2 you have to choose the masterrecord and fields which has to move to masterrecord.
For comparison: In the standard potential duplicates the screen for step2 looks like the following:
https://ibb.co/5x7hfFv
I want to do this the exact same way. Here comes my problem: I didn't find a structure provided by apexcontroller that is able to iterate in a way to this list that columns and rows are syncron. The prepared structure of (selected) data records should be combined in such a way that they can be passed on to an apex controller, which then takes over the merge process.
One of my various solutions provide the following structure: Map<Id, List<Map<String, String>>>. Where key of map is the record id. The value of the outer map is a list with a map (key: apiname, value: fieldvalue). But this structure does not fit to the columns of screen2 and you can't iterate over map. Also a template expression doesn't allow NumericLiteral to access a specific index or key. It seems like everything has to be a list.
If I can realize this list of the selection, the processing of the data sets in Apex is only a child's play. Today I have worried all day about it and have not found an adequate solution.
Any suggestions for a provided structure of objects, arrays, maps to rule this target?
After i finished that components and everything works fine I am willing to publish the corresponding components.
sorry for my missspelling. What I meant is the Iteration in <template> is not possible and it is not possible to reference and Index i.e. Index[0] in <template>.
One of first attempts for this solution looks like the follwing:
Than in js I extract the first row for the selection of master record in the following way:
This approch and retrieved structure from apex is NOT applicable for the other rows and columns to iterate over it and select field values to merge.
I didn't solve it. We use Duplicate Check (AppExchange: https://appexchange.salesforce.com/appxListingDetail?listingId=a0N300000058vzKEAQ) now.
Best regards,
Christian