magritton
6/22/2017 - 1:47 AM

This script snippet sets the select to a value contained in the URL. Also an example of the SOD/

This script snippet sets the select to a value contained in the URL. Also an example of the SOD/

<script>
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', setSelect);

function setSelect()
{
var customerSelect = document.querySelectorAll("[title$='Customer Required Field']");
var getParam = getParameterByName('custid');

if(getParam){
	customerSelect[0].value=getParam;
	}
}//end function

function getParameterByName(name) {
	return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [, ""])[1].replace(/\+/g, '%20')) || null;
}
</script>