{"id":118,"date":"2009-07-05T17:21:22","date_gmt":"2009-07-05T17:21:22","guid":{"rendered":"http:\/\/www.myfatblog.co.uk\/?p=118"},"modified":"2009-07-05T17:21:22","modified_gmt":"2009-07-05T17:21:22","slug":"pre-populating-the-bdc-item-picker-in-an-application-page","status":"publish","type":"post","link":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/07\/pre-populating-the-bdc-item-picker-in-an-application-page\/","title":{"rendered":"Pre-populating the BDC item picker in an application page"},"content":{"rendered":"<p>Adam Toth wrote a very good article on his old blog about using the BDC Entity Picker in an application page. <a href=\"http:\/\/www.sharepointblogs.com\/toth\/archive\/2008\/06\/02\/using-a-bdc-item-entity-picker-control-in-custom-sharepoint-application-pages.aspx\">Click here for the article.<\/a><\/p>\n<p>What Adam didn&#8217;t cover however is what happens if you want to pre-load that picker with some information. In my instance, I was copying a list item with BDC data in it and wanted to allow the user to view and change the selected BDC field.<\/p>\n<p>It turns out that it wasn&#8217;t as difficult as I was expecting, and after some research in the SDK about the BDC Item picker I was able to produce the effect I wanted.<\/p>\n<p>I&#8217;m going to assume that you&#8217;ve followed Adam&#8217;s guide thus far and have been able to get the BDC Itempicker on your page and have it talking properly to the BDC (E.g. you can search for an item and have it populate the picker.) If you haven&#8217;t got this far, go and do that first as it&#8217;s fundamental to what we&#8217;re going to do.<\/p>\n<p>So in my scenario, The list item has a BDC field for Client name. The first thing that you need to understand is how SharePoint stores the BDC Field data in the SharePoint list. I was expecting to have a new field type to play around with, but No, it&#8217;s much easier than that, you get two strings. One for the display value and one for the Entity key.<\/p>\n<p>In my BDC application definition, I have an entity called dbo.Customers and this has already been added to the list definition as a Business Data column. If you write a quick console application to browse through the field names, you&#8217;ll find 2 fields, one called &#8220;Client&#8221; frm the field definition in the list and one called &#8220;dbo_x002e_Customer_ID&#8221; (This latter one was added when the field was configured.)<\/p>\n<p>So with the values of these two fields we can create a PickerEntity which can be understood by the BDC Itempicker.<\/p>\n<p>The PickerEntity was declared earlier in the code and then is used as follows:-<\/p>\n<pre lang=\"csharp\">\r\nif (item[\"Client\"] != null)\r\n{\r\n    if (item[\"dbo_x002e_Customer_ID\"] != null)\r\n    {\r\n        peClient = new PickerEntity();\r\n        peClient.DisplayText = item[\"Client\"].ToString();\r\n        peClient.Key = item[\"dbo_x002e_Customer_ID\"].ToString();\r\n        bdcClientSelector.Entities.Add(bdcClientSelector.ValidateEntity(peClient));\r\n    }\r\n}\r\n<\/pre>\n<p>Hopefully this will help demystify the Itempicker a little..<\/p>\n<p>Paul.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Adam Toth wrote a very good article on his old blog about using the BDC Entity Picker in an application page. Click here for the article. What Adam didn&#8217;t cover however is what happens if you want to pre-load that picker with some information. In my instance, I was copying a list item with BDC &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/07\/pre-populating-the-bdc-item-picker-in-an-application-page\/\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[30,13,16,1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Pre-populating the BDC item picker in an application page - Blog of an overweight SharePoint addict<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/07\/pre-populating-the-bdc-item-picker-in-an-application-page\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pre-populating the BDC item picker in an application page - Blog of an overweight SharePoint addict\" \/>\n<meta property=\"og:description\" content=\"Adam Toth wrote a very good article on his old blog about using the BDC Entity Picker in an application page. Click here for the article. What Adam didn&#8217;t cover however is what happens if you want to pre-load that picker with some information. In my instance, I was copying a list item with BDC &hellip; Continue reading\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/07\/pre-populating-the-bdc-item-picker-in-an-application-page\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog of an overweight SharePoint addict\" \/>\n<meta property=\"article:published_time\" content=\"2009-07-05T17:21:22+00:00\" \/>\n<meta name=\"author\" content=\"Cimares\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cimares\" \/>\n<meta name=\"twitter:site\" content=\"@cimares\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Cimares\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/07\/pre-populating-the-bdc-item-picker-in-an-application-page\/\",\"url\":\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/07\/pre-populating-the-bdc-item-picker-in-an-application-page\/\",\"name\":\"Pre-populating the BDC item picker in an application page - Blog of an overweight SharePoint addict\",\"isPartOf\":{\"@id\":\"http:\/\/www.myfatblog.co.uk\/#website\"},\"datePublished\":\"2009-07-05T17:21:22+00:00\",\"dateModified\":\"2009-07-05T17:21:22+00:00\",\"author\":{\"@id\":\"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/55ae8f6885bb5b8390dad001f3da83c6\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/07\/pre-populating-the-bdc-item-picker-in-an-application-page\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.myfatblog.co.uk\/#website\",\"url\":\"http:\/\/www.myfatblog.co.uk\/\",\"name\":\"Blog of an overweight SharePoint addict\",\"description\":\"The rantings of a (not so) food obsessed IT consultant!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.myfatblog.co.uk\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/55ae8f6885bb5b8390dad001f3da83c6\",\"name\":\"Cimares\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/www.myfatblog.co.uk\/images\/BlogImages\/About_D057\/TopOfTheWorld.jpg\",\"contentUrl\":\"http:\/\/www.myfatblog.co.uk\/images\/BlogImages\/About_D057\/TopOfTheWorld.jpg\",\"caption\":\"Cimares\"},\"sameAs\":[\"http:\/\/www.myfatblog.co.uk\"],\"url\":\"http:\/\/www.myfatblog.co.uk\/index.php\/author\/reginald\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pre-populating the BDC item picker in an application page - Blog of an overweight SharePoint addict","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/07\/pre-populating-the-bdc-item-picker-in-an-application-page\/","og_locale":"en_US","og_type":"article","og_title":"Pre-populating the BDC item picker in an application page - Blog of an overweight SharePoint addict","og_description":"Adam Toth wrote a very good article on his old blog about using the BDC Entity Picker in an application page. Click here for the article. What Adam didn&#8217;t cover however is what happens if you want to pre-load that picker with some information. In my instance, I was copying a list item with BDC &hellip; Continue reading","og_url":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/07\/pre-populating-the-bdc-item-picker-in-an-application-page\/","og_site_name":"Blog of an overweight SharePoint addict","article_published_time":"2009-07-05T17:21:22+00:00","author":"Cimares","twitter_card":"summary_large_image","twitter_creator":"@cimares","twitter_site":"@cimares","twitter_misc":{"Written by":"Cimares","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/07\/pre-populating-the-bdc-item-picker-in-an-application-page\/","url":"http:\/\/www.myfatblog.co.uk\/index.php\/2009\/07\/pre-populating-the-bdc-item-picker-in-an-application-page\/","name":"Pre-populating the BDC item picker in an application page - Blog of an overweight SharePoint addict","isPartOf":{"@id":"http:\/\/www.myfatblog.co.uk\/#website"},"datePublished":"2009-07-05T17:21:22+00:00","dateModified":"2009-07-05T17:21:22+00:00","author":{"@id":"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/55ae8f6885bb5b8390dad001f3da83c6"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.myfatblog.co.uk\/index.php\/2009\/07\/pre-populating-the-bdc-item-picker-in-an-application-page\/"]}]},{"@type":"WebSite","@id":"http:\/\/www.myfatblog.co.uk\/#website","url":"http:\/\/www.myfatblog.co.uk\/","name":"Blog of an overweight SharePoint addict","description":"The rantings of a (not so) food obsessed IT consultant!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.myfatblog.co.uk\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/55ae8f6885bb5b8390dad001f3da83c6","name":"Cimares","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.myfatblog.co.uk\/#\/schema\/person\/image\/","url":"http:\/\/www.myfatblog.co.uk\/images\/BlogImages\/About_D057\/TopOfTheWorld.jpg","contentUrl":"http:\/\/www.myfatblog.co.uk\/images\/BlogImages\/About_D057\/TopOfTheWorld.jpg","caption":"Cimares"},"sameAs":["http:\/\/www.myfatblog.co.uk"],"url":"http:\/\/www.myfatblog.co.uk\/index.php\/author\/reginald\/"}]}},"_links":{"self":[{"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/118"}],"collection":[{"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=118"}],"version-history":[{"count":0,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/118\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.myfatblog.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}