I am sure i am not seeing it (my bad ), but I am unsuccessfully trying to set a msg property to an array of objects to feed an email node using a change node.
I need to set the msg.attachments property to something like: [{path:"/home/pi/SailingLog.txt"}] to properly initialize the email node and send a file as attachment.
I have been successful using a function node to set that property, but I am sure the same could be done inside the change node.
I have tried using this flow but it doesn't work; the flow.FileName variable contains the absolute path to the file to be attached.
[
{
"id": "c50dd6f42e704e6a",
"type": "change",
"z": "0ec062a8f4963dc2",
"name": "prepare",
"rules": [
{
"t": "set",
"p": "attachments",
"pt": "msg",
"to": "[{ path: flow.get(\"FileName\")}]",
"tot": "jsonata"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "SailingLog.txt",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "Last Sailing Log file",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 300,
"y": 840,
"wires": [
[
"e14648409ce7dcd2"
]
]
},
{
"id": "ae933d51732689bb",
"type": "inject",
"z": "0ec062a8f4963dc2",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 840,
"wires": [
[
"c50dd6f42e704e6a"
]
]
},
{
"id": "e14648409ce7dcd2",
"type": "debug",
"z": "0ec062a8f4963dc2",
"name": "debug 5",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 480,
"y": 840,
"wires": []
}
]
Any clue will be greatly appreciated, advanced thanks