{"id":323,"date":"2021-05-18T06:46:22","date_gmt":"2021-05-18T06:46:22","guid":{"rendered":"http:\/\/4us2use.at\/?p=323"},"modified":"2021-05-19T08:47:30","modified_gmt":"2021-05-19T08:47:30","slug":"update-sharepoint-lookup-field-multiple-values-allowed-from-standalone-power-app","status":"publish","type":"post","link":"http:\/\/4us2use.at\/?p=323","title":{"rendered":"Update SharePoint Lookup Field (multiple values allowed) from standalone Power App"},"content":{"rendered":"\n<p class=\"has-medium-font-size\"><strong>Problem:<\/strong><\/p>\n\n\n\n<p>It may turn tricky to update SharePoint items from a standalone Power App, if you&#8217;ve configured a SP lookup column to allow multiple values.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"300\" height=\"390\" src=\"http:\/\/4us2use.at\/wp-content\/uploads\/2021\/05\/lookupmulti-e1621319465123.png\" alt=\"\" class=\"wp-image-324\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Solution:<\/strong><\/p>\n\n\n\n<p>All you need to get around that issue, is to add another ComboBox to the datacard in the Power App form.<br>Then also create a data connection to the list, where the lookup values reside.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" width=\"746\" height=\"198\" src=\"http:\/\/4us2use.at\/wp-content\/uploads\/2021\/05\/combo.png\" alt=\"\" class=\"wp-image-325\" srcset=\"http:\/\/4us2use.at\/wp-content\/uploads\/2021\/05\/combo.png 746w, http:\/\/4us2use.at\/wp-content\/uploads\/2021\/05\/combo-300x80.png 300w\" sizes=\"(max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Settings for the ComboBox:<\/strong><\/p>\n\n\n\n<p><strong>DefaultSelectedItems:<\/strong> If(Not(IsBlankOrError(Parent.Default)),Parent.Default)<\/p>\n\n\n\n<p><strong>OnChange:<\/strong> ClearCollect(myCol,ForAll(ComboBox1.SelectedItems,{Id: ThisRecord.ID,Value:ThisRecord.Title}));Reset(DataCardValue3)<\/p>\n\n\n\n<p><strong>OnSelect: <\/strong>Clear(myCol)<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Settings for the origin lookup dropdown:<\/strong><\/p>\n\n\n\n<p>Change the setting for &#8220;<strong>multiple selections allowed<\/strong>&#8221; to &#8220;true&#8221;<\/p>\n\n\n\n<p> <strong>DefaultSelectedItems:<\/strong> If(Not(IsBlank(Parent.Default)) &amp;&amp; IsEmpty(myCol),Parent.Default,myCol)<\/p>\n\n\n\n<p>(myCol = the collection created in the ComboBox OnChange property)<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Explanation:<\/strong><\/p>\n\n\n\n<ul><li>First we check, if there are already values available in the source item<\/li><li>the OnChange makes sure, that whenever we select new items, the collection myCol will be updated accordingly<\/li><li>the Reset() makes sure, that the values in the origin dropdown will also be updated<\/li><li>the Clear() function resets the collection, when the user starts a new selection<\/li><li>the origin dropdown will always have the selected items from the ComboBox<\/li><li>last but not least, hide the origin dropdown and that&#8217;s it<\/li><\/ul>\n\n\n\n<p>One more important thing to mention!<br>Keep the &#8220;Update&#8221; property of the datacard as &#8220;DataCardValuexx.SelectedItems&#8221; &#8211; if you try to pass in a table, the submit form function will fail. That&#8217;s the trick here.<\/p>\n\n\n\n<p>Enjoy!<\/p>\n\n\n\n<span id=\"post-ratings-323\" class=\"post-ratings\" data-nonce=\"e0021e93ba\"><img id=\"rating_323_1\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"1 Star\" title=\"1 Star\" onmouseover=\"current_rating(323, 1, '1 Star');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/><img id=\"rating_323_2\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"2 Stars\" title=\"2 Stars\" onmouseover=\"current_rating(323, 2, '2 Stars');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/><img id=\"rating_323_3\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"3 Stars\" title=\"3 Stars\" onmouseover=\"current_rating(323, 3, '3 Stars');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/><img id=\"rating_323_4\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"4 Stars\" title=\"4 Stars\" onmouseover=\"current_rating(323, 4, '4 Stars');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/><img id=\"rating_323_5\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"5 Stars\" title=\"5 Stars\" onmouseover=\"current_rating(323, 5, '5 Stars');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/> (No Ratings Yet)<br \/><span class=\"post-ratings-text\" id=\"ratings_323_text\"><\/span><\/span><span id=\"post-ratings-323-loading\" class=\"post-ratings-loading\"><img src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/loading.gif\" width=\"16\" height=\"16\" class=\"post-ratings-image\" \/>Loading...<\/span>\n","protected":false},"excerpt":{"rendered":"<p>Problem: It may turn tricky to update SharePoint items from a standalone Power App, if you&#8217;ve configured a SP lookup column to allow multiple values. Solution: All you need to get around that issue, is to add another ComboBox to the datacard in the Power App form.Then also create a data connection to the list, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/4us2use.at\/?p=323\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Update SharePoint Lookup Field (multiple values allowed) from standalone Power App&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11,6],"tags":[],"_links":{"self":[{"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/posts\/323"}],"collection":[{"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4us2use.at\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=323"}],"version-history":[{"count":2,"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/posts\/323\/revisions"}],"predecessor-version":[{"id":328,"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/posts\/323\/revisions\/328"}],"wp:attachment":[{"href":"http:\/\/4us2use.at\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4us2use.at\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=323"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4us2use.at\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}