如何将业务事件获取的数据映射到json对象

问题描述 投票:0回答:1

我自定义了D365的业务事件,从业务事件中取出的数据需要组成一个json数组

我从业务事件中解析了 json,我正在尝试组成 json 数组以将其发送到第三方服务。

解析 json 步骤的输出如下

{
  "body": {
    "BillClientId": "abcdef",
    "BillRad": "Request",
    "Boxes": 0,
    "BusinessEventId": "SBSalesInvoicePostingBusinessEvents",
    "BusinessEventLegalEntity": "usmf",
    "comt": "",
    "ContextRecordSubject": "",
    "ControlNumber": 123456,
    "CustAccount": "",
    "Description": "",
    "DestAddressType": "DESTINATION",
    "Destcity3": "San Diego",
    "Destcity4": "San Diego",
    "DestclntName": "Contoso Retail Los Angeles",
    "Destcontacto": "Contoso Retail San Diego",
    "DestCountry": "USA",
    "Destdoor": "S/N",
    "Destemail": "[email protected]",
    "Destphone": "123-444-555"
  }
}

我正在尝试以图像中所示的格式编写数据,我正在尝试将先前解析 json 步骤中的值分配给撰写,但由于未获取值,我无法获得预期的输出。输出没有数据,任何人都可以让我知道有没有办法实现它或者我是否犯了任何错误。

{ “身体”: { “要求”: { “数据”: [ { "billClntId": " @{body('Parse_JSON')?['properties']?['BillClientId']}", "billRad": "@{body('Parse_JSON')?['properties']?['BillRad']}", “comt”:“”, “listRefs”:[ {

我相信我正在尝试添加属性如何添加值

azure-logic-apps dynamics-365
1个回答
0
投票

我同意@Skin,感谢您引领正确的方向,使其成为帮助他人的解决方案。

从我这边转载的问题按照以下步骤得到了预期的结果。

  • 下图是我拍的logic App的工作流程。 enter image description here

    Taken 当收到 http 请求时触发检索数据,如您所述。 enter image description here

{

"properties": {

"body": {

"properties": {

"BillClientId": {

"type": "string"

},

"BillRad": {

"type": "string"

},

"Boxes": {

"type": "integer"

},

"BusinessEventId": {

"type": "string"

},

"BusinessEventLegalEntity": {

"type": "string"

},

"ContextRecordSubject": {

"type": "string"

},

"ControlNumber": {

"type": "integer"

},

"CustAccount": {

"type": "string"

},

"Description": {

"type": "string"

},

"DestAddressType": {

"type": "string"

},

"DestCountry": {

"type": "string"

},

"Destcity3": {

"type": "string"

},

"Destcity4": {

"type": "string"

},

"DestclntName": {

"type": "string"

},

"Destcontacto": {

"type": "string"

},

"Destdoor": {

"type": "string"

},

"Destemail": {

"type": "string"

},

"Destphone": {

"type": "string"

},

"comt": {

"type": "string"

}

},

"type": "object"

}

},

"type": "object"

}

然后采取解析Json动作,在“Content”字段中,设置触发器输出的“Body”参数,在“Schema”字段中采用JSON模式。 enter image description here

  • 添加 Compose 操作并按下图所示进行输入以获得所需的输出。 enter image description here
  • Logic App 成功运行,下面是 compose 操作的预期输出。 enter image description here enter image description here

撰写的输出

{

"body": {

"request": {

"data": [

{

"billClntId": "abcdef",

"billRad": "Request",

"comt": "",

"listRefs": [

{}

]

}

]

}

}

}

注意:进入下一个表达式时,您需要为此正确编辑问题。

© www.soinside.com 2019 - 2024. All rights reserved.