Giter VIP home page Giter VIP logo

object-mapping-tool's Introduction

Object Mapping Setup Tool

The Field Mapping Setup Tool for setting up custom and standard Salesforce SObject field mappings with providing a user-friendly interface.

See usage in the Object Conversion Tool

  • The Lightning Web Component include features such as add, edit and delete field mappings, and the ability to save, load, reload and delete the mapping configurations called templates.
  • It allows to select the source and target objects and fields and to traverse up to 5 levels of relationships.

img.png img.png

 <c-object-mapping-table onmappingtemplatechange={handleMappingTemplateChange}>
</c-object-mapping-table>

Attributes

  • title: The title of the mapping setup tool.
  • target-object-api-names: The list of target (convert from) object api names to filter the selectable templates and source objects by.
  • source-object-api-names: The list of source (convert to) object api names to filter the selectable templates and target objects by.
  • template-select-disable: The flag to disable the template to change, clear or delete after it is loaded,only save and reload are allowed.
  • hide-field-mappings: The flag to hide the field mappings and only show the template selector.
  • read-only: The flag to make the field mappings read-only, and only show the template selector and field mappings.
  • onmappingtemplatechange: The event handler to handle the mapping template change event.
    • Returns the mapping template id, source object api name and target object api name.
handleMappingTemplateChange(event){
  this.selectedTemplateId= event.detail.id;
  this.selectedSourceObjectApiName = event.detail.sourceObjectApiName;
  this.selectedTargetObjectApiName = event.detail.targetObjectApiName;
}

Invocable Methods

  • loadMappingTemplate: Loads the mapping template by the given mapping template id.
  • resetMappingTemplate: Resets the mapping template to the default state.

Object Mapping Template API

Provides a basic implementation for converting records using the ObjectMappingTemplate.

//Initialize the object mapping template converter and selector
ObjectMappingTemplateConverter objectMappingTemplateConverter = new ObjectMappingTemplateConverterImpl();
ObjectMappingTemplatesSelector objectMappingTemplatesSelector = new ObjectMappingTemplatesSelector();

//Get the object mapping template
Id accountToContactTemplateId = 'a007S0000068ndvQAA';
ObjectMappingTemplate accountToContactMappingTemplate =
        objectMappingTemplatesSelector.getObjectMappingTemplates(new Set<Id>{accountToContactTemplateId})[0];

Id accountIdToConvert = '0017S00000JD7jBQAT';

//Convert the account to a contact
Map<Id,SObject> accountIdContactMap = objectMappingTemplateConverter
        .convertRecords(new List<Id>{accountIdToConvert},accountToContactMappingTemplate);

//Get the converted contact
Contact convertedContact = (Contact) accountIdContactMap.get(accountIdToConvert);
insert convertedContact;
System.debug(convertedContact.Id);

object-mapping-tool's People

Contributors

p-adrian05 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.