KWizCom Support Center

Using a custom .aspx page to create advanced default value outputs.



I would like to have the default values tool return all values corresponding to a lookup value in another list.

Eg. I have a staff list set up in one list and a list of offices in another list.

In a third list, I want to be able to select an office from a dropdown menu and have the staff list field automatically populate with all staff members tied to that office 


This can be done by using a custom .aspx file. Download the .aspx file from:

In your web front end server, browse to the following path and create a folder:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\

The folder can be named anything and will be the destination which the custom .aspx file will be placed. For this example we will call the folder "DefaultValueQueries" making the full path in which to deposit the .aspx file:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\DefaultValueQueries

On your SharePoint site, go to the list where you want to set up the field to automatically populate. Then go to List Settings >  KWizCom forms settings > Dynamic Default Values > External Value > Select external value(Blue circle with yellow arrow icon) >KWizCom External Values Management (the "click here" link at the bottom of the page) > Add a new external value. That brings you to the below page:

Copy and paste the below string into the URL (with query string if needed) field:

 [Current Site]/_layouts/[Folder]/GetComputedDefaultValueFromLookups.aspx?web=[web]&list=[list]&lookupfieldname=[lookupitemid]&combinelookupfieldname=[lookupfieldname]&lookupitemid=[lookupitem]

Replace each of the highlighted tokens with data based on the following criteria:

Current site - This would be the current SharePoint site where you have the list. If you browse to your list, copy everything before /_layouts/ eg.
Folder - Enter the name of the folder where you deposited the custom .aspx file on your server eg. DefaultValueQueries
web - The URL to the source lookup site. This is where you will be pulling the autopopulated data from. eg.
list - The name of the source lookup list that you will be pulling the autopopulated data from. eg. "Staff"
lookupitemid - Populate the name of the field from the source list that data from the current list will be compared to here eg. "Office"
lookupfieldname - This is the field in lookup list where you will pull the actual data from eg. "Title"
lookupitem - This is the field in the current list that will send data to the query. You can either populate it with the name of the field in the current list or leave it as a token to be filled in via the default values manager. eg. "Team" . We will leave it as a token for this example however.

The finished string would look something like this:[LookupID]

Name the External Value rule and click Save.

In your external value selection screen, you can now select this new external value rule and apply the field name to the token. In this example, the name of the rule is "GetStaffListbyOfficeID" so it will show up as GetStaffListbyOfficeID([LookupID)] in the list of rules. Select it and replace the token with the field in the current list that will be sending data to the source list to compare. Make sure to leave the brackets when entering the name of the current field. It should look as follows:

Complete adding the rule to the default values and save the settings. You will now be able to automatically populate data from any field that matches a lookup field.

On a scale of 1-5, please rate the helpfulness of this article

Not Helpful
Very Helpful
Optionally provide private feedback to help us improve this article...

Thank you for your feedback!

Last Modified: 5 Years Ago
Last Modified By: dean
Level: Intermediate
Rated 3 stars based on 2 votes.
Article has been viewed 2.2K times.
Also In This Category