{"id":3833,"date":"2020-06-04T14:14:40","date_gmt":"2020-06-04T14:14:40","guid":{"rendered":"https:\/\/himbap.com\/blog\/?p=3833"},"modified":"2020-06-04T14:15:21","modified_gmt":"2020-06-04T14:15:21","slug":"make-sure-to-keep-primary-field-in-lookup-view-uci","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=3833","title":{"rendered":"Make sure to keep primary field in Lookup view &#8211; UCI"},"content":{"rendered":"<p><strong>Problem<\/strong><br \/>\nRecently faced one issue where lookup control was showing as &#8220;No Name&#8221;, so we are going to discuss steps to solved it.<\/p>\n<p><strong>Solution<\/strong><br \/>\nWhen I saw this issue, first thing I checked primary field in the parent entity if it contains data or not, but it was not blank. Another strange thing I noticed, as soon as I saved value was coming correctly.<\/p>\n<p>Normally this type of issue occurs if<\/p>\n<p>&gt; Primary field is blank (as by default primary field is displayed in the lookup control)<br \/>\n&gt; If we are setting up lookup using javascript and while setting we are not setting name field.<\/p>\n<p>In this case non of the above condition was true as there was not script involved in setting up lookup field. I also checked the relationship to make sure ti is setup correctly.<\/p>\n<p>After that I thought of looking into lookup view, while looking at lookup field, I noticed there was a different view setup as default. Next I checked field in that view and found primary field was not there, I know all lookup view have primary field by default and we can&#8217;t remove that field from lookup view. So I added primary field there and after that I was able to see correct name in the lookup control.<\/p>\n<p>So if you have changed view for the lookup control make sure primary field is there!<\/p>\n<p>Hope it will help someone!<br \/>\n<strong>Keep learning, Keep sharing !!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem Recently faced one issue where lookup control was showing as &#8220;No Name&#8221;, so we are going to discuss steps to solved it. Solution When I saw this issue, first thing I checked primary field in the parent entity if it contains data or not, but it was not blank. Another strange thing I noticed, as soon as I saved&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=3833\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[21,402,8,275,10],"tags":[767,766,769,765,768],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3833"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3833"}],"version-history":[{"count":4,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3833\/revisions"}],"predecessor-version":[{"id":3837,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3833\/revisions\/3837"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}