Hot to return a value from a custom action?

I have a component with a defined custom action workflow “Just Do”. Within that I return a value:

When I invoke the custom action from the outside in another workflow, how do I access that return value?

The screenshot shows what I’m trying: calling the custom action and alerting the result from WF action 1 (which I suppose should contain the actual return value?!)

Thanks
/Henrik

just type return [your_value]

1 Like

Sorry, just don’t getting it - isn’t that what I’m doing in the first screenshot by specifying the return value. Doing it as Javascript makes no difference.

OK, so I figured it out - it’s obviously a promise that is returned in the event. So I have to do something like this to make it work:

image

1 Like

If it’s a promise you can also simply await it, WeWeb’s JavaScript actions allow you to do top level await, which imo is less messy, but it’s a question of a personal preference

const res = await context.workflow['___ID___'].result
alert(res)

:slight_smile: Also, always console log your values, it usually tells you right away the issue.

1 Like