Ad Code

Responsive Advertisement

Dynamic Field Mapping

Purpose:
The purpose of this post is to understand how we can do and create a Dynamic mapping. This post will guide you how we can achieve Dynamic field mapping in between X-Object to Y-Object columns. sometimes clients/customer always have an requirement that customer wants to copy the entire information of the record from one X-Object record to Y-Object record.

Use Case:
One Company has a requirement that they have published one Customer Portal. and In this Customer Portal customer(user) always log-in in and Submit a Event Booking Request Form. And this Booking Request form will be submitted to the sales for Approval. After Approval of this submission of the Record , system will, create two separate record 1. Opportunity and 2. Event. And here system will using Booking Request form Data and copying it to the Designated Objects(Opportunity,Event).


Solution:
Based on above Use Case , In Salesforce we need to create following component.

1. Custom Settings
2. Apex Class

Create One Custom Setting see Below:


Then click on Manage Button to create some custom setting Data. We need to Provide the Source Object: Column Name and as well as Destination Object: Column Name . See Below



After Creating a Custom Data you need to Write the Apex Logic that will run either using Apex Trigger or either you can put this code on Custom Button Click.

To See the Entire Code Click Here :
Apex Code


See Following Constructor information



Following Code will help you to insert the Record Y-Record with help of Y-Object. See below Image




To See the Entire Code Click Here :
Apex Code


Happy coding.




Reactions

Post a Comment

1 Comments