问题描述
我正在尝试从 RPC 动态呈现 spec
的 collection
(规范)。无法让它工作。这里我附上了'模块->可映射参数'和'远程过程->通信'的代码。
模块 -> 可映射参数
[
{
"name": "birdId","type": "select","label": "Bird Name","required": true,"options": {
"store": "rpc://selectbird","nested": [
{
"name": "variables","type": "collection","label": "Bird Variables","spec": [
"rpc://birdVariables"
]
}
]
}
}
]
远程程序 -> 通讯
{
"url": "/bird/get-variables","method": "POST","body": {
"birdId": "{{parameters.birdId}}"
},"headers": {
"Authorization": "Apikey {{connection.apikey}}"
},"response": {
"iterate":{
"container": "{{body.data}}"
},"output": {
"name": "{{item.name}}","label": "{{item.label}}","type": "{{item.type}}"
}
}
}
提前致谢。
解决方法
刚刚尝试了以下方法,它奏效了。根据 Integromat's Docs,您可以像这样对 wrapper
使用 rpc
指令:
{
"url": "/bird/get-variables","method": "POST","body": {
"birdId": "{{parameters.birdId}}"
},"headers": {
"Authorization": "Apikey {{connection.apikey}}"
},"response": {
"iterate":"{{body.data}}","output": {
"name": "{{item.name}}","label": "{{item.label}}","type": "{{item.type}}"
},"wrapper": [{
"name": "variables","type": "collection","label": "Bird Variables","spec": "{{output}}"
}]
}
}
您的 mappable parameters
将如下所示:
[
{
"name": "birdId","type": "select","label": "Bird Name","required": true,"options": {
"store": "rpc://selectbird","nested": "rpc://birdVariables"
}
}
]
,
我自己需要这个。拉入具有不同类型但希望它们全部显示给用户的自定义字段以更新自定义字段或在创建联系人时能够更新它们。不确定是否最好让它们全部显示或有一个选择下拉菜单然后让用户使用多个地图。
这是我对自定义字段的 Get 回复。你能展示我的代码应该是什么样子吗?像往常一样在输出中添加一个值时有点困惑,您是否需要在 integromat 中使用两个单独的 RPC?注意到您的商店和嵌套不同。
{
"customFields": [
{
"id": "5sCdYXDx5QBau2m2BxXC","name": "Your Experience","fieldKey": "contact.your_experience","dataType": "LARGE_TEXT","position": 0
},{
"id": "RdrFtK2hIzJLmuwgBtAr","name": "Assisted by","fieldKey": "contact.assisted_by","dataType": "MULTIPLE_OPTIONS","position": 0,"picklistOptions": [
"Tom","Jill","Rick"
]
},{
"id": "uyjmfZwo0PCDJKg2uqrt","name": "Is contacted","fieldKey": "contact.is_contacted","dataType": "CHECKBOX","picklistOptions": [
"I would like to be contacted"
]
}
]
}