【问题标题】:Need to manipulate results of line item with a code step in Zapier需要在 Zapier 中使用代码步骤操作订单项的结果
【发布时间】:2019-12-09 11:52:02
【问题描述】:

Screenshot of my sample

我有一个 python 代码步骤,它返回一个行项目对象,其中包含一些组件的名称、它们的组件 ID 和组件的分配(见屏幕截图)

现在我只需要返回 component_allocation 大于 1 且组件名称包含“User”的值集

也就是说,对于图片中我要返回的数据:

组件名称:附加用户、企业、年度 组件分配:5 组件 ID:587086

我在组件名称中的逗号是否会使这变得不可能?我不擅长编码(轻描淡写),而且我不明白订单项如何运作良好。我几乎可以使用电子表格样式的公式步骤而不是代码步骤来做到这一点,因为它支持行项目,但没有 FIND 或 SEARCH 函数来匹配单词“user”

【问题讨论】:

    标签: zapier


    【解决方案1】:

    我以前遇到过这种情况。幸运的是,您可以控制第 3 步代码步骤中的返回。我通过以下方式解决了它:

    1. 返回 JSON 字符串列表而不是(或连同)对象列表。您的回报如下所示:
    [
      '{"component_allocation": 0, "component_name": "Addition user, monthly", "component_id": 565257}', 
      '{"component_allocation": 5, "component_name": "Addition user, yearly", "component_id": 565258}', 
      '{"component_allocation": 25, "component_name": "Addition user, biennual", "component_id": 565259}'
    ]
    
    1. 在您的新代码步骤中将 JSON 字符串转换为对象。
    2. 现在运行普通代码

    【讨论】:

      猜你喜欢
      • 2019-12-12
      • 2017-06-28
      • 2018-08-23
      • 1970-01-01
      • 2018-08-05
      • 1970-01-01
      • 1970-01-01
      • 2018-10-03
      • 2019-10-05
      相关资源
      最近更新 更多