如何在 Azure 逻辑应用程序中将变量设置为 'null'?

How to set a variable to 'null' in a Azure Logic App?

我需要在特定情况下将 null 发送到 CRM 端点。

因为我需要逻辑应用程序多个部分的值,所以我想使用一个变量。

此代码仅将变量设置为 "" 而不是 null。 在 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"
                ]
              }
            }

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

试试这个:

"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"
                ]
              }
            }

HTH