Fill lookup field automatically from Url Parameter


I want to fill automatically a lookup field from an Url Parameter.

I have a list A with a field URL that open a forms on List B with th ID of Field from List AÉlément/NewForm.aspx?ListA=ID

How to recover this parameter and auto fill the field on List B ?

have a nice Day

Hello @bsteam!

Please use the below code in JavaScript Editor.
It will set the lookup field value to the ID from the URL Parameter on the form load.

Please replace {LookupFieldName} with your Lookup Field internal name.

fd.spRendered(function() {
$.urlParam = function(name){
	var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
	return results[1] || 0;

fd.field("{LookupFieldName}").value = $.urlParam('ListA'); // name
1 Like

thanks , it's working

1 Like