Skip to main content
Betelhem Derzineh 님이 #MuleSoft에 질문했습니다

Hi

I am retrieving a csv file from google drive then inserting it to Salesforce Object Tasks.

I have the below mapping for the CSV schema:

%dw 2.0

output application/json

---

payload map (item, index) -> {

 "CustID": item."CustID",

 "ReceiptNo": item."ReceiptNo",

 "RecDate": item."Rec.date" as Number as DateTime {format: 'dd/MM/yyyy'},

 "Amount": item."Amount",

 "TaskID": item."Task ID",

 "Reason": item."Reason" 

}

This the salesforce mapping:

 [ 1+ ] Tasks

     [ 1+ ] Account

        [ 0, 1 ] Geo_Number__c mapped to CustID

     [ 1+ ] Head_Office_name__r

        [ 0, 1 ] Geo_Number__c mapped to CustID

 

[ 0, 1 ] Direct__c mapped to Amount

[ 0, 1 ] Receipt_Date__c mapped to RecDate

[ 0, 1 ] Receipt_No__c mapped to ReceiptNo

[ 0, 1 ] New_Comment__c mapped to Reason

[ 0, 1 ] UserId mapped to TaskID

This is doing a Tasks insert.  The CustID is the Head Off from the csv.  The insert is relating the Tasks to the Account and Head Office Name record using the CustId (Head Off), in Salesforce the Geo_Number__c, which is an external Id on those objects.

How can i map this in dataweave please. 

답변 1개
  1. 2024년 6월 20일 오후 3:51

    Hi @Betelhem Derzineh,

    Please check out the MuleSoft DataWeave documentation for handling CSV formats. It provides essential guidance on parsing CSV files directly in DataWeave, which will help you accurately transform your CSV data into Salesforce compatible JSON for Task insertion. Link: CSV Format

     

    For additional insights, refer:

    https://docs.mulesoft.com/dataweave/latest/dataweave-cookbook-map 

     

    Thanks!

0/9000