首页 > 解决方案 > 如何在 Azure 逻辑应用程序中将变量设置为“null”?

问题描述

我需要在某个 if 案例下将 null 发送到 CRM 端点。

由于我需要逻辑应用程序的多个部分的值,我想使用一个变量。

此代码仅将变量设置为“”,但不设置为空。在 IC_CODE 不是“05”的情况下,我需要 null。

"Set_variable_conditional_interchangability": {
              "type": "SetVariable",
              "inputs": {
                "name": "conditional_interchangability",
                "value": "@{if(equals(items('For_each')?['IC_CODE'], '05'), 928350000, null)}"
              },
              "runAfter": {
                "Set_variable_direction": [
                  "Succeeded"
                ]
              }
            }

标签: azure-logic-apps

解决方案


因为您在值中使用了花括号{},所以运行时会将空值转换为空字符串。

尝试这个:

"Set_variable_conditional_interchangability": {
              "type": "SetVariable",
              "inputs": {
                "name": "conditional_interchangability",
                "value": "@if(equals(items('For_each')?['IC_CODE'], '05'), 928350000, null)"
              },
              "runAfter": {
                "Set_variable_direction": [
                  "Succeeded"
                ]
              }
            }

高温高压


推荐阅读