Pass URL parameter to SharePoint new form (NewForm.aspx) to auto-populate a lookup field

I recently received a request to create an education listing of courses where a user could “Register” easily for upcoming opportunities. This required creating two lists: one for courses and another for the registrations.

The most important part of this was that when a user clicked “Register Here” on a calendar item, it would take them to this separate registration form on a completely different list and auto-populate the Training lookup drop-down based on which “Register Here” link they clicked.

Courses list (calendar app)

The first list for courses, Courses, is a calendar app with the courses. It has two necessary columns you must add:

  • A calculated column called Training: =IF([End Time]>=NOW(),(TEXT([Start Time],”YYYY-MM-DD HH:MM AM/PM”)&” | “&Title),””)
  • A custom hyperlink-type field called Register Here. The value is set by a simple SharePoint Designer workflow.

The link is structured so that when clicked, it’ll take the user to the NewForm.aspx form for the registrations list (ContinuingEdRegistration). The user will enter their info there to register for the course.

For the workflow, I used a simple two-step 2010 platform workflow for the Courses list, set to trigger on creation OR change.

When setting the variable in the workflow:

  1. Click the ellipses (three dots) to open “String builder”
  2. Paste the normal link to the second list’s NewForm.aspx page (ContinuingEdRegistration in my example)
  3. Add ?Training= to the end of it, replacing Training with whatever URL parameter you’re wanting to use to help in auto-populating a field
  4. Click “Add or change lookup” to add Current Item –> ID
  5. Add a comma and a space (will not work without space)
  6. Enter link text, like Register Here

The second (and last) step is to set the hyperlink field we created (Register Here) to that variable from the first step. Publish the workflow.

You can set the calendar view to whatever works best – an actual calendar, a list, boxed, etc. as long as the registration link is available to users to click.

ContinuingEdRegistration list (Custom list app)

The ContinuingEdRegistration list and new form is simple:

  • A lookup column to our Training on the first list
  • A field for the user being registered

The key to this working is editing this ContinuingEdRegistration’s NewForm.aspx page seen above and adding the following script via a Script Editor web part or Content Editor web part. Thanks to Emiliano Poggi for sharing the script that inspired this solution.

<script type="text/javascript">

function getUrlParameter( name )
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null ) return "";
else return results[1];
function populateNewForm()
document.getElementById("Training_67194962-c685-4033-8744-701fd9f26beb_$LookupField").value = getUrlParameter("Training");

Be sure to update both the “ID” boxed below, as well as the URL parameter to look for (used in the SPD workflow between ? and =).

Click to enlarge

If you’re unfamiliar with getting element IDs using F12/developer tools, just go to the NewForm.aspx, hit F12, choose the “selector” probably a mouse as seen here and then left-click the element (dropdown) to get its ID. The following screenshot is using Chrome to find the ID (in blue following the # mark):

Click to enlarge

Once you’ve updated the script for your specific fields, you can either copy and paste it into a script editor web part or save the script as a .js file in a folder like Site Assets then reference it in a Content Editor web part like this:

Click to enlarge

Once you’ve pasted a link to the script in the content editor web part properties panel, click OK. Then you can stop editing/save the page to continue.


To test your solution, just modify or create a new calendar item. Here’s what should happen:

  1. Your SPD workflow runs, setting the “Register Here” hyperlink field to the correct URL with that item’s unique ID included
  2. Your user clicks that hyperlink on the calendar item and is taken to the Registration list’s NewForm.aspx page. Note that the URL should include ?Training=123 or something similar at the end- this is the URL parameter the script is looking for.
  3. The script finds the URL parameter and dynamically updates the dropdown to the lookup choice that matches the ID.
  4. The user completes the rest of the registration fields and saves/submits.

Taking it further

A further enhancement might be adding &source=CoursesListURL to the URL created in the workflow to redirect users to the calendar again after registering.

Ta-da! Best of luck.

Microsoft Delve blogs to be retired; Existing Delve blogs to be deleted in 2020

Thanks to a tweet by Tim Milan of Omaha, I heard today that Microsoft Delve blogs are to be deleted in a few months.

Milan’s news came from Office 365 Premier Support in response to a ticket he’d submitted. The email is as follows:

Click to enlarge

Delve was first announced alongside the Office Graph in 2014 at SharePoint Conference. Even though it’s only been out for a little over five years, the retirement of Delve in general has been a topic of speculation for nearly two years now (and perhaps longer for others). Some have wondered whether to invest time learning and promoting the app anymore, and perhaps this news will help guide those decisions.

Important dates:

The following points are taken from the email body seen above.

  • Beginning December 18th, 2019, tenants can no longer create new Delve blogs.
  • Beginning January 18th, 2020, you can no longer create new posts in existing blogs
  • Beginning April 17th, 2020, existing Delve blogs will be deleted and removed from Delve profiles.

What now?

If you read this post and asked yourself, “What’s a Delve blog?” don’t worry about it. It was a convenient feature that allowed your average user to create and maintain a blog they could share in the organization.

If you read this post and realized you have hundreds of user and group blogs out there to manage and just a few months to figure it out, you have some choices to consider.

The email shown earlier in this post suggests creating communication sites and adding News, Yammer, and Stream web parts for engagement but this isn’t a good plan for all blogs as not all users can create sites for themselves. Even those that can create sites may find site creation and management a bit too complex or too large of a scope compared to running a simple blog.

You could consider creating WordPress or Blogger sites and migrating your posts there. Unfortunately, there is no RSS feed for Delve blogs to export. You’d be manually copying and pasting (or recreating) posts.

You might consider disabling Delve if you’d like to prevent users from beginning something that’ll be removed soon. You can do this through the SharePoint admin center for all users (see directions here). Keep in mind this disables more than just blog creation – read the description before proceeding.

Click to enlarge

No matter what you choose, there’s no easy way forward. I would suggest getting your users involved in saving (print to PDF or copy/paste) posts of importance so that they can be posted as documents elsewhere, or recreated at a later time in another space.

Ready, set, change management!

MS-101 Exam Study Guide

Below you’ll find all exam areas and objectives with related documentation to help you prepare for the exam. Most of the references below are summarized in my exam prep book.

Implement modern device services (30-35%)

Implement Microsoft 365 security and threat management (30-35%)

Manage Microsoft 365 governance and compliance (35-40%)

Make room on your shelf

Check out these two MS-101 exam prep books. The first is written by Nate Chamberlain.