Dynamic mapping returns 'Failed to load fields'

Hi, I’m working on a Monday app that returns data from another app every 24 hours.

Everything is going well so far, but when I try to create the recipe and click on ‘Item’, it returns ‘Failed to load fields’.

image

I am receiving 3 POST requests when I click on ‘item’, so it’s very likely that I’m not returning the right data.

I’m receiving this in the POST request (changed the numbers):
{‘payload’: {‘side’: ‘source’, ‘recipeId’: 12345678, ‘integrationId’: 12345678, ‘dependencyData’: {‘fieldTypeId’: 12345678}}}

I followed all steps of this article

At the ‘Call your trigger’ part, it says I need to return:
{
“trigger”: {
“outputFields”: { ///values of all output fields, which were configured for your custom trigger
“myEntity”: {
“field1” : “Hello world!”,
“field2” : “This is another field”
}
}
}
}

My code looks like this.
I tried it with normal ‘return data’ as well (and 100 other tries haha)
image

Field type:


Workflow block

Recipe:

Help would be greatly appreciated!

Hello there @patrick7!

I believe you might be confusing the fields definition with the request you need to send to trigger your trigger.

Your fields definitions endpoint should like something like this:

async function getRemoteFieldDefs(req, res) {
  return res.status(200).send([
    { id: 'name', title: 'Name', outboundType: 'text', inboundTypes: ['text'] },
    { id: 'desc', title: 'Description', outboundType: 'text', inboundTypes: ['empty_value', 'text', 'text_array'] },
    { id: 'dueDate', title: 'Due Date', outboundType: 'date', inboundTypes: ['empty_value', 'date', 'date_time'] },
    { id: 'people', title: 'People', outboundType: 'user_emails', inboundTypes: 'user_emails' },
    { id: 'creationDate', title: 'CreateDate', outboundType: 'date_time', inboundTypes: ['date', 'date_time'] },
  ]);
}

Then you are going to get a webhookUrl when the recipe is added. And to that webhookUrl you need to send a request when you want the trigger to be triggered:

{
  "trigger": {
    "outputFields": { ///values of all output fields, which were configured for your custom trigger
      "myEntity": {
        "field1" : "Hello world!",
        "field2" : "This is another field"
      }
    }
  }
}

I hope that helps!

Cheers,
Matias