Skip to content

Lookup value from relation from condition callback #446

Answered by jmikrut
jmrkll asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @Salomo — I can give you some pointers here!

So, payload.findByID is a local API method, which means it's only available in contexts where you're executing code on your server. As conditions are executed in the browser, those local API methods are not available.

Instead, you should just do a fetch. Which, if you think about it, because you're in the browser—that's really the only way to do something like that.

One note though—field conditions are run quite frequently, because every time a field value changes, you need to run the condition. For a use case like this, I'd probably build a custom component, where you can make that fetch much less frequently. That would be more performant.

W…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jmrkll
Comment options

Answer selected by jmrkll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants