Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can create multiple data items at the same time in two ways.

  1. Place multiple objects in an array. In the following image, an array with two data items is given in the payload of the Dynamic Data Manager node.

    Image Modified
  2. Create an array in the function node placed before the Dynamic Data Manager node. The following code lets you create a sample array and store it in msg.payload.data.

Code Block
var _ = global.get('lodash');
var sample = [
               {
                 SampleText : "Google",
                 SampleURL  : "https://www.google.com/"
               },
               {
                 SampleText : "Amazon",
                 SampleURL  : 'https://www.amazon.com/'
               }
             ];
_.set(msg,'payload.data',sample);

When using this method to create multiple data items, the payload in the Dynamic Data Manager node should be left empty.

Update

If the field is available in the schema, the content of that field will be updated with the content given in the payload. The _id is used to identify the data item (required). The field that you want to update must be inside the data object. For example, in the following image, hospitalCounty is a field available in the schema that will be updated with the data “county”.

...

If the queried fields are available, the schema fields are updated with the content given in the payload. In the following example, queried fields are available, but one of the payload properties is not available in the schema. NewField is not available in the schema. Except for NewField, all the other fields will be updated based on the payload.

...

Alternatively, you can create an array in the function node placed before the Dynamic Data Manager node to send the data to msg.payload.data.

Code Block
var data = 
{
  "ids": [
        "221778457701379939"
    ],
    "221778457701379939": {
        "q": "<p><img alt=\"\" height=\"380px\" src=\"https://s3.amazonaws.com/orbitahealth/clients/adira-prod/assets/dynamic/images/806417701b38147f0-94e4-11ea-a6f4-fbb89749aa9b15a8209f0-bc62-11ea-9309-83ecac418749.png\" width=\"380px\" /></p>\n\n<p>Hey there! I’m Wanda from New York.</p>\n<hr/><p>If you’re pregnant, have a baby, or have a little one up to 5 years old, WIC is here to support you!</p>\n<hr/><p>Citizenship and immigration status doesn’t matter, and, of course, this discussion is private.</p>\n<hr/><p>I’m here to make your life a little easier. Click Start if you’re cool with the <a href=\"https://www.adirallc.com/privacy-policy.html\" onclick=\"window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=500,left=100,height=500,top=100'); return false;\">Terms and Privacy Policy!</a></p>\n",
        "question": "<img height=\"380px\" src=\"https://s3.amazonaws.com/orbitahealth/clients/adira-prod/assets/dynamic/images/806417701b38147f0-94e4-11ea-a6f4-fbb89749aa9b15a8209f0-bc62-11ea-9309-83ecac418749.png\" width=\"380px\" /><br />  Hey there! I’m Wanda from New York.<br /> If you’re pregnant, have a baby, or have a little one up to 5 years old, WIC is here to support you!<br /> Citizenship and immigration status doesn’t matter, and, of course, this discussion is private.<br /> I’m here to make your life a little easier. Click Start if you’re cool with the Terms and Privacy Policy!<br /> ",
        "startTime": "2020-07-03T09:21:18.531Z",
        "endTime": "2020-07-03T09:21:34.216Z",
        "answer": "Start"
    }
}
msg.payload.

...

data = 
{
    "jsonfield_schemakey": data
};
return msg;

When using this method to create multiple data items, the payload in the Dynamic Data Manager node should be left empty.

Queried fields are not available

...