我有需要在函数中呈现的动态子级输入字段,但是当它们存在时,则它们不会正确地包含在inputData中/不在父输入字段的键下。当将子级直接包含在inputFields中时,它会按预期工作,但是我无法在Zapier的children数组内使用函数。
[当前为inputData,当在函数中呈现订单项时,LI_表示它是子输入键-
"inputData": {
"supplier": "1",
"LI_budget": 1,
"LI_tax": 1,
"company": "1",
"currency": "1",
"LI_price": "1",
"LI_description": "1"
}
我期望(“父母”是这里的inputField父键):
"inputData": {
"supplier": "1",
"parent": [{
"LI_budget": 1,
"LI_tax": 1,
"LI_price": "1",
"LI_description": "1"
}],
"company": "1",
"currency": "1",
}
这是我用来提取父项和子项输入字段的功能:
const getLineItems = async (z, bundle) => {
let lineItem = {
key: 'parent',
children: [{
key: 'LI_description',
label: 'Description',
required: true
},
{
key: 'LI_budget',
required: true,
label: 'Budget',
dynamic: 'budget.id'
},
{
key: 'LI_price',
required: true,
type: 'number',
label: 'Unit price',
helpText: 'Example: 50.25'
},
{
key: 'LI_tax',
required: true,
label: 'Tax Rate',
dynamic: 'tax_rate.id'
},
]
}
return [lineItem];
};
我在getLineItems函数中生成了一些动态字段,以简化它们。 TIA
inputData
的外观(例如,是否像1,2,3
一样拆分了多个项目或以其他方式拆分)。如果您想对此进行迭代,最好切换到我们的公共开发人员Slack(http://zpr.io/ttvdr);然后我们可以将结果发布在这里,以供下一个人碰到。 😁