-
Notifications
You must be signed in to change notification settings - Fork 460
ObjectConversionRecipes
pozil edited this page Nov 14, 2024
·
3 revisions
Demonstrates how to convert data in CSV or JSON format
into Salesforce sObjects and Apex objects using DataWeave scripts in Apex.
Notice that all script output MIME types are set to application/apex
.
Group DataWeaveInApex Recipes
Converts CSV data into a list of contact records.
Uses the /dw/csvToContacts.dwl
DataWeave script.
public static List<Contact> convertCsvToContacts(String inputCsv)
Name | Type | Description |
---|---|---|
inputCsv | String | CSV data to tranform |
List<Contact>
List of contact records
Converts JSON data into a list of contact records.
Uses the /dw/jsonToContacts.dwl
DataWeave script.
public static List<Contact> convertJsonToContacts(String inputJson)
Name | Type | Description |
---|---|---|
inputJson | String | JSON data to tranform |
List<Contact>
List of contact records
Converts CSV data into a list of Apex objects.
Uses the /dw/csvToApexObject.dwl
DataWeave script.
public static List<CsvData> convertCsvToApexObject(String inputCsv)
Name | Type | Description |
---|---|---|
inputCsv | String | CSV data to tranform |
List<CsvData>
List of Apex ,[object Object], objects