Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.
SOLVED

Is there a way to have an external lookup field autopopulate a value if there is only one query result?

Avatar

Level 3

I have a lookup project for markets and many of them are 1:1 with a single city. If someone chooses a market and there is only one city resulting, is there any way to autoselect that value instead of them manually having to select the single result from the dropdown?  Is this a place where a Fusion scenario might be a better fit than an external lookup field?

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 3

Actually, @Sven-iX  and @GregoryBu5 ,  I think I have noticed something lately - perhaps this has happened with a recent update. I am seeing behavior now that if the result of the external lookup query is a list, the list is shown in the dropdown, but if the result has a determinate, single value, that is shown in the field (even though the dropdown arrow is still there) and the field takes on the value immediately without selection.  I tested it by adding a calculated field that only contains the external lookup field. 

If the query results in a list, the calculated field waits until a selection is made to populate. 

VynetaRy_0-1754670623706.png

But if the query only pulls one result, both the external lookup field and the calculated field update without requiring selection! 

VynetaRy_1-1754670705147.png

This also works if you use a function like length() in your JSON path that results in a definite value - as in returning the number of results based on another field. 

VynetaRy_2-1754670931859.pngVynetaRy_3-1754670968022.png

So it looks like this is now working as I had hoped it would! 

View solution in original post

5 Replies

Avatar

Community Advisor

You can't auto-populate a field based on the query returning a single result. 

You definitely could let Fusion do that but what if there are 2 markets to the selected City?

 

How many Cities are in the dropdown and how many are 1:1 with a market? 

 

A different approach could be to return the combined string City + Market in one external lookup. 

Avatar

Level 1

I hear what you are saying, but I'm not sure that is what the OP intended. I have a situation right now - where I know I'm only going to get 1 result in the External Lookup.  I don't want the user to have to "select" it to get it to display - I just want to display the value - once it's returned. 

Can't this also be an "output" option - like the "multi select" options?  Or is there another way to do this with the External Lookup? 

Avatar

Community Advisor

Hey Greg - I get that; but if an external lookup is a single-select, it works like a normal dropdown - you still have to click the choice. (or maybe I'm still missing what you mean?)

Would be cool though if we could have a calculated field that can make the API call and just display the returned value. 

Avatar

Correct answer by
Level 3

Actually, @Sven-iX  and @GregoryBu5 ,  I think I have noticed something lately - perhaps this has happened with a recent update. I am seeing behavior now that if the result of the external lookup query is a list, the list is shown in the dropdown, but if the result has a determinate, single value, that is shown in the field (even though the dropdown arrow is still there) and the field takes on the value immediately without selection.  I tested it by adding a calculated field that only contains the external lookup field. 

If the query results in a list, the calculated field waits until a selection is made to populate. 

VynetaRy_0-1754670623706.png

But if the query only pulls one result, both the external lookup field and the calculated field update without requiring selection! 

VynetaRy_1-1754670705147.png

This also works if you use a function like length() in your JSON path that results in a definite value - as in returning the number of results based on another field. 

VynetaRy_2-1754670931859.pngVynetaRy_3-1754670968022.png

So it looks like this is now working as I had hoped it would! 

Avatar

Community Advisor

Oh super - thank you for sharing!!