=============== LIBRARY RULES =============== From library maintainers: - Use Data Mapper Extract for Salesforce → JSON (read). - Use Data Mapper Load for JSON → Salesforce (insert/update/upsert). - Use Data Mapper Transform for JSON → JSON reshape (no Salesforce I/O). - Prefer Turbo Extract for single-sObject reads when no formulas are needed (2-10x faster). - Respect FLS and CRUD via Required Permission property; never use WithoutSharing as a shortcut. - Use Environment Variables for org-specific configuration; never hard-code IDs or URLs. - Cache reference data via Cache settings; configure appropriate TTL. - Test Data Mappers in the Preview tab before invoking from IPs/Omniscripts/Apex. ### Data Mapper Load Example with bulkUpload Source: https://github.com/slorenzot/context7-llm-omnistudio-data-mappers/blob/main/07-calls-from-apex.md This example demonstrates passing the bulkUpload parameter to a Data Mapper Load operation. Replace placeholder values with your specific Data Mapper name and input data. ```apex String objectList = '[{"ProductCode__c": 11050665},{"ProductCode__c": 11070100}]'; // replace this with the input for your Data Mapper Load String bundleName = 'DRLoadPrice'; // replace this with your Data Mapper name Map bodyData = new Map(); bodyData.put('bundleName',bundleName); bodyData.put('objectList',objectList); List jsonInputData = new List(); jsonInputData.add(bodyData.get('objectList')); ConnectApi.DataMapperExecuteInputRepresentation apexInput = new ConnectApi.DataMapperExecuteInputRepresentation(); apexInput.dataMapperInput = jsonInputData; apexInput.inputType = 'JSON'; ConnectApi.DataMapperExecuteOptionsRepresentation options = new ConnectApi.DataMapperExecuteOptionsRepresentation(); options.ignoreCache = false; apexInput.options = options; options.shouldSendLegacyResponse = true; ConnectApi.DataMapperExecuteOutputRepresentation output = ConnectApi.OmniDesignerConnect.executeDataMapper(bodyData.get('bundleName'), apexInput); List innerResponse = output.response; Map outerMap = (Map) JSON.deserializeUntyped(innerResponse[0]); List keys = new List(outerMap.keySet()); System.debug(outerMap.get('drSObjectResults')); ``` -------------------------------- ### Call Data Mapper Load from Apex Source: https://github.com/slorenzot/context7-llm-omnistudio-data-mappers/blob/main/07-calls-from-apex.md This snippet shows how to call a Data Mapper for load operations. It includes setting up the input as a JSON string, invoking the Data Mapper, and processing the response to access created objects and errors. ```Apex String objectList = '{"accountName":"Vlocity", "contractCode":"SKS9181"}'; List jsonInputData = new List(); jsonInputData.add(objectList); ConnectApi.DataMapperExecuteInputRepresentation apexInput = new ConnectApi.DataMapperExecuteInputRepresentation(); apexInput.dataMapperInput = jsonInputData; apexInput.inputType = 'JSON'; ConnectApi.DataMapperExecuteOptionsRepresentation options = new ConnectApi.DataMapperExecuteOptionsRepresentation(); options.ignoreCache = false; options.shouldSendLegacyResponse = true; apexInput.options = options; ConnectApi.DataMapperExecuteOutputRepresentation output =ConnectApi.OmniDesignerConnect.executeDataMapper(bundleName, apexInput); List innerResponse = output.response; String currentResponse = innerResponse[0]; System.debug(currentResponse); Map outerMap = (Map) JSON.deserializeUntyped(currentResponse); List keys = new List(outerMap.keySet()); System.debug(outerMap.get('drSObjectResults')); /* Process the results of the load: these methods return details about objects affected by the Data Mapper Load, in addition to any errors that occured */ Map createdObjectsByType = (Map)resultMap.get('createdObjectsByType'); Map createdObjectsByTypeForBundle = (Map)createdObjectsByType.get('bundleName'); Map createdObjectsByOrder = (Map)resultMap.get('createdObjectsByOrder'); Map errors = (Map)resultMap.get('errors'); ``` -------------------------------- ### Add Context7 to Prompt Source: https://github.com/slorenzot/context7-llm-omnistudio-data-mappers/blob/main/README.md To ground AI responses in this documentation, add 'use context7' to your prompt in supported clients. ```text use context7 ``` -------------------------------- ### Call Data Mapper Extract or Transform from Apex Source: https://github.com/slorenzot/context7-llm-omnistudio-data-mappers/blob/main/07-calls-from-apex.md Use this snippet to call a Data Mapper for extract or transform operations. It demonstrates how to populate input data, call the Data Mapper using ConnectApi, and process the results by deserializing the output. ```Apex /* Specify Data Mapper extract or transform to call */ String bundleName = 'DataMapperName'; /* Populate the input JSON */ Map objectList = new Map{'MyKey'=>'MyValue'}; /* Call the Data Mapper */ String jsonString = JSON.serialize(objectList); List jsonInputData = new List(); jsonInputData.add(jsonString); ConnectApi.DataMapperExecuteInputRepresentation apexInput = new ConnectApi.DataMapperExecuteInputRepresentation(); apexInput.dataMapperInput = jsonInputData; apexInput.inputType = 'JSON'; ConnectApi.DataMapperExecuteOptionsRepresentation options = new ConnectApi.DataMapperExecuteOptionsRepresentation(); options.locale = null; options.shouldSendLegacyResponse = true; apexInput.options = options; ConnectApi.DataMapperExecuteOutputRepresentation output = ConnectApi.OmniDesignerConnect.executeDataMapper(bundleName, apexInput); /* Process the results returned by a Data Mapper Extract or Transform */ List innerResponse = output.response; for (String currentResponse : innerResponse){ Map outerMap = (Map) JSON.deserializeUntyped(currentResponse); List keys = new List(outerMap.keySet()); System.debug(outerMap.get('response')); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.