簡體   English   中英

如何從 mule 4 中的 salesforce output 有效負載中刪除字段名稱“類型”

[英]How to remove fieldname “type” from salesforce output payload in mule 4

我正在使用 Salesforce “查詢”連接來獲取 Mule 4 中的數據。但是,output 有效負載正在顯示一個名為 type 的附加字段(顯示 ObjectName)。 有什么辦法可以避免獲取/顯示這個字段?

傳遞給 Salesforce 的輸入查詢:“Select AccountNumber,Name,Id from Account”

Output:可以看到,我不想顯示“類型”。

 [
  {
    "Id": "0012x0000054TjZAAU",
    **"type": "Account"**,
    "AccountNumber": "CD355120-B",
    "Name": "United Oil & Gas, Singapore"
  },
  {
    "Id": "0012x0000054TjUAAU",
    **"type": "Account"**,
    "AccountNumber": "CD439877",
    "Name": "Grand Hotels & Resorts Ltd"
  }
]

預期的 Output:在 output 中沒有“類型”。

 [
  {
    "Id": "0012x0000054TjZAAU",
    "AccountNumber": "CD355120-B",
    "Name": "United Oil & Gas, Singapore"
  },
  {
    "Id": "0012x0000054TjUAAU",
    "AccountNumber": "CD439877",
    "Name": "Grand Hotels & Resorts Ltd"
  }
]

快速解決方案:

Map 在每個項目上並刪除該字段

%dw 2.0
output application/json
---
payload map $ - "type"

Output:

[
  {
    "Id": "0012x0000054TjZAAU",
    "AccountNumber": "CD355120-B",
    "Name": "United Oil & Gas, Singapore"
  },
  {
    "Id": "0012x0000054TjUAAU",
    "AccountNumber": "CD439877",
    "Name": "Grand Hotels & Resorts Ltd"
  }
]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM