Passing URL from one page to to newitem.aspx or other way round

rt96 1 Reputation point
2020-08-10T08:09:51.927+00:00

I have a SharePoint page, which ends in ?ProjUID= (then a guid). Is there a way to grab this, and add it to the next page (which is the new list item newitem.aspx page)

Or the other way round I guess, when the new list item page appears, grab the projuid part of the url from the previous page

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,820 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Anupam Shrivastava 176 Reputation points
    2020-08-10T08:26:32.307+00:00

    I understand, you have a SharePoint online page and added some web part there to show the details of the project based on the Project ID. Grabbing that from URL is easy enough. You can create a simple SPFx web part and put that on the page.

    A sample function to grab the ProjUID could look like this:

      private GetCodefromURL(): string {  
        var queryParms = new UrlQueryParameterCollection(window.location.href);  
        var myParm = queryParms.getValue("ProjUID");  
        if (myParm) {  
          return myParm.trim();  
        } else {  
          return null;  
        }  
      }  
    

    and the you can customize the NewItem page using PowerApps to grab the ProjUID and implement your logic. Simply click on Customize using PowerApps in the New form.

    16669-pa.jpg

    0 comments No comments

  2. rt96 1 Reputation point
    2020-08-10T10:47:46.68+00:00

    Thank you - in regards to the PowerApps bit, how do I do that bit? Effectively i have a field in the SP list I would like to populate with the ProjUID part? And which webpart is the SPFx one?


  3. Amos Wu-MSFT 4,051 Reputation points
    2020-08-11T01:40:57.69+00:00

    You get the ProjUID in url this way:geturlparameter.txt
    Which way do you use to link to the next page?If there is no relationship between the two pages, it is difficult to pass parameters between them.If you use 'a' tag or js function to link to the next page,you could append ths ProjUID got from current page to the newForm url,like

    http://sp/Lists/test/newForm.aspx?ProjUID=0cf684d4-0fe3-e93d-1e25-d193dca4aa33  
    

    Then you could get the ProjUID in newForm page with the above script.

    0 comments No comments