我有需要在函数中呈现的动态子输入字段,但是当它们出现时,它们不会正确包含在 inputData 中/不在父输入字段的键下。当孩子直接包含在 inputFields 中时,它按预期工作,但我不能在 Zapier 的孩子数组中使用函数。
这是当前的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