2

I have a custom lwc that isn't directly linked to an object instance.

On this lwc, I would like to use the lwc lookup input to lookup a related object and get its id.

I'm struggling to do this, as it seems that lookup fields require either a new object or an existing object instance to work.

Is there anyway to use this lookup field without modifying or creating new object?

2

As you've observed, the built-in component needs a record to work with. However, there are open source versions (try searching for "lwc lookup field github") that you could modify to work without a record.

1

You can also check out an alternative lookup component (more lightweight) here. It's not exactly what you are looking for but you can iterate and extend this component for a related object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.