-
-
Save atskimura/da96c75c7a0f64d62893e6337c344c79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CSV data for Contacts | |
String inputCsv = 'first_name,last_name,email\nCodey,"The Bear",codey@salesforce.com'; | |
DataWeave.Script script = new DataWeaveScriptResource.csvToContacts(); | |
DataWeave.Result dwresult = script.execute(new Map<String, Object>{'records' => inputCsv}); | |
List<Contact> results = (List<Contact>) dwresult.getValue(); | |
Assert.areEqual(1, results.size()); | |
Contact codeyContact = results[0]; | |
Assert.areEqual('Codey', codeyContact.FirstName); | |
Assert.areEqual('The Bear', codeyContact.LastName); | |
Assert.areEqual('codey@salesforce.com', codeyContact.Email); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%dw 2.0 | |
input records application/csv | |
output application/apex | |
--- | |
records map(record) -> { | |
FirstName: record.first_name, | |
LastName: record.last_name, | |
Email: record.email | |
} as Object {class: "Contact"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment