Unexpected error on Smart Action Form values retrieval

I have problem with Smart Actions that contains form since a few days.

When I trigger a smart action, here is the kind of message I have :

Here is the kind of Smart Action that produces the bug :

{
      name: "📃 CrĂ©er une facture",
      type: "single",
      fields: [
        {
          field: "Document provisoire ?",
          isRequired: true,
          description:
            "Un document provisoire est un brouillon et ne pourra ĂȘtre envoyĂ© au destinataire.",
          type: "Enum",
          enums: ["NON", "OUI"],
        },
      ],
      hooks: {
        load: async ({ fields, record }) => {
          fields["Document provisoire ?"].value = "NON";
          return fields;
        },
      },
      endpoint: "/forest/actions/create-an-invoice",
    },

Context

I didn’t upgrade to the last version on Liana.

Hi @XavierColombel,

Can you please provide your server logs?
Also can you please provide your routes declarations?
Something should overlap somewhere.
(please note the async on load hook is not required)

Best

I have additional question:

Are your form data correctly loaded?

Yes @Sliman_Medini, all is correctly loaded.

I’ve no error on server side and no route is duplicated or overlapped.

I even tried to make a new route, I have the same error in Chrome.

Here is my Smart Action :

{
      name: "TEST ROUTE",
      type: "single",
      fields: [
        {
          field: "Here is a field",
          isRequired: true,
          description: "field test",
          type: "Enum",
          enums: ["NON", "OUI"],
        },
      ],
      hooks: {
        load: async ({ fields, record }) => {
          return fields;
        },
      },
      endpoint: "/forest/actions/create-a-test-route-with-form",
    }

And my code in /routes :

router.post(
  "/actions/create-a-test-route-with-form",
  permissionMiddlewareCreator.smartAction(),
  (req, res) => {
    return new RecordsGetter(Fundings)
      .getIdsFromRequest(req)
      .then(async (fundingsIds) => {
        try {
          return res.send({
            success: `ok`,
          });
        } catch (error) {
          console.log({ error });
          return res.status(400).send({
            error: `La facture n'a pas pu ĂȘtre crĂ©Ă©e : problĂšme API, vĂ©rifier dans /routes/fundings.js`,
          });
        }
      });
  },
);

Ok, is this meaning an error is displayed but everything is working fine?

Thank

Yes, it seems to work fine.

Ok good,

I am going to create an issue to solve this useless warning.
Thank you for the feedback

Best

1 Like