{"id":2439,"date":"2025-09-28T18:33:07","date_gmt":"2025-09-28T16:33:07","guid":{"rendered":"https:\/\/blog.kodono.info\/wordpress\/?p=2439"},"modified":"2025-09-28T18:33:07","modified_gmt":"2025-09-28T16:33:07","slug":"how-to-pass-a-parameter-from-the-url-to-a-sharepoint-form-2025","status":"publish","type":"post","link":"https:\/\/blog.kodono.info\/wordpress\/2025\/09\/28\/how-to-pass-a-parameter-from-the-url-to-a-sharepoint-form-2025\/","title":{"rendered":"How to pass a parameter from the URL to a SharePoint Form (2025)"},"content":{"rendered":"<p>For a few months, there is a new way to display a new form for a SharePoint List, using Microsoft Forms:<br \/>\n<a href=\"https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/sp_toolbar.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/sp_toolbar-1024x54.png\" alt=\"\" width=\"660\" height=\"35\" class=\"aligncenter size-large wp-image-2440\" srcset=\"https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/sp_toolbar-1024x54.png 1024w, https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/sp_toolbar-300x16.png 300w, https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/sp_toolbar-768x41.png 768w, https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/sp_toolbar.png 1056w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/a><\/p>\n<p>This kind of form can be useful for intake requests or surveys. But how to pass a parameter in the URL to apply it to a field in the form?<\/p>\n<p>Here is the solution I deployed:<\/p>\n<ol>\n<li>Create a Power Automate Flow that will replace the default value of the field with a defined value<\/li>\n<li>Create a Power App to intercept the parameter from the URL, to trigger the above flow, and to redirect the user to the form<\/li>\n<li>The user will see the defined value in the field because we use the default value<\/li>\n<li>A few seconds later, the flow will change back the default value to blank<\/li>\n<\/ol>\n<p>It works well. The only downside is that we cannot have more than 1 person clicking on the link at the same time (and within a range of 15 seconds).<\/p>\n<h2>1) The Power Automate Flow<\/h2>\n<p><a href=\"https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/flow.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/flow.png\" alt=\"\" width=\"327\" height=\"590\" class=\"aligncenter size-full wp-image-2442\" srcset=\"https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/flow.png 327w, https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/flow-166x300.png 166w\" sizes=\"auto, (max-width: 327px) 100vw, 327px\" \/><\/a><\/p>\n<p>The flow is called by a Power App with a string parameter.<\/p>\n<p>Then we do an HTTP call to SharePoint with the below details:<\/p>\n<ul>\n<li><strong>Method<\/strong>: PATCH<\/li>\n<li><strong>Uri<\/strong>: _api\/web\/lists\/GetByTitle(&#8216;SHAREPOINT LIST NAME&#8217;)\/Fields\/GetByInternalNameOrTitle(&#8216;FIELD_ID&#8217;)<\/li>\n<li><b>Headers<\/b>: &#8220;Accept: application\/json;odata=nometadata&#8221;, &#8220;Content-Type: application\/json;odata=nometadata&#8221;, and &#8220;IF-MATCH: *&#8221;<\/li>\n<li><b>Body<\/b>: we use a JSON <code>{\"DefaultValue\": \"VALUE PROVIDED BY APP\"}<\/code><\/li>\n<\/ul>\n<p>By default value, I mean this information (legacy SharePoint interface):<br \/>\n<a href=\"https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/defaultvalue.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/defaultvalue.png\" alt=\"\" width=\"220\" height=\"74\" class=\"aligncenter size-full wp-image-2447\" \/><\/a><\/p>\n<p>Once the default value of the field has been updated, we respond back to the Power App.<\/p>\n<p>We add a 15-second delay.<\/p>\n<p>And finally, we do another HTTP call to SharePoint, with the same info, except for the body that becomes <code>{\"DefaultValue\":\"\"}<\/code> to reset the default value.<\/p>\n<h2>2) The Power App<\/h2>\n<p><a href=\"https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/powerapp.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/powerapp.png\" alt=\"\" width=\"491\" height=\"129\" class=\"aligncenter size-full wp-image-2444\" srcset=\"https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/powerapp.png 491w, https:\/\/blog.kodono.info\/wordpress\/wp-content\/uploads\/2025\/09\/powerapp-300x79.png 300w\" sizes=\"auto, (max-width: 491px) 100vw, 491px\" \/><\/a><\/p>\n<p>Instead of giving the direct link to the form to the user, we&#8217;ll give them a link to the Power App. The URL must contains the param value (e.g. &#8220;&#038;Title=Code_123456&#8221;).<\/p>\n<p>The App can have a short text (e.g. &#8220;click the below button to get to the survey&#8221;) with a button &#8220;Go to the form&#8221;.<\/p>\n<p>When the user clicks on the button, it will trigger the flow we created in step 1, and then it will redirect the user to the form.<\/p>\n<p>To do so, for <code>OnSelect<\/code> on the button:<\/p>\n<pre>\r\n\/\/ we can change the aspect of the button to indicate something is happening\r\nSet(buttonLabel, \"Loading survey\u2026\");\r\nSet(buttonMode, DisplayMode.Disabled);\r\n\r\n\/\/ decode the \"Title\" param that is passed in the URL\r\nSet(\r\n  titleParam,\r\n  Substitute(\r\n    Substitute(\r\n        Substitute(\r\n        Substitute(\r\n            Substitute(Param(\"Title\"), \"%3A\", \":\"),\r\n            \"%2F\", \"\/\"\r\n        ),\r\n        \"%3F\", \"?\"\r\n        ),\r\n        \"%3D\", \"=\"\r\n    ),\r\n    \"%26\", \"&#038;\"\r\n    )\r\n);\r\n\r\n\/\/ call the Power Automate Flow\r\n'PowerApps\u2013SetURLParamasDefaultValue'.Run(titleParam);\r\n\r\n\/\/ then redirect to the form\r\nLaunch(urlToForm, {}, LaunchTarget.Replace);\r\n<\/pre>\n<h2>3) Let&#8217;s the magic happen<\/h2>\n<p>When the user clicks on the button:<\/p>\n<ul>\n<li>the flow runs,<\/li>\n<li>the flow changes the default value using the provided param,<\/li>\n<li>the flow says to the app to proceed,<\/li>\n<li>the app redirects the user to the form,<\/li>\n<li>the form shows up with the field that already contains the provided value<\/li>\n<li>15 seconds later (the time for the form to load), the flow resets the default value<\/li>\n<ol>\n","protected":false},"excerpt":{"rendered":"<p>For a few months, there is a new way to display a new form for a SharePoint List, using Microsoft Forms: This kind of form can be useful for intake requests or surveys. But how to pass a parameter in the URL to apply it to a field in the form? Here is the solution [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","hide_page_title":"","footnotes":""},"categories":[15,170,20],"tags":[153,123,155],"class_list":["post-2439","post","type-post","status-publish","format-standard","hentry","category-astuce","category-english","category-niveau-expert","tag-astuce","tag-english","tag-niveau-expert"],"_links":{"self":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/2439","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/comments?post=2439"}],"version-history":[{"count":7,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/2439\/revisions"}],"predecessor-version":[{"id":2452,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/posts\/2439\/revisions\/2452"}],"wp:attachment":[{"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/media?parent=2439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/categories?post=2439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.kodono.info\/wordpress\/wp-json\/wp\/v2\/tags?post=2439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}