|  | @@ -1554,7 +1554,8 @@ function afterStudyData(configUpload,data){
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  function afterStudyUpload(configUpload,data){
 | 
	
		
			
				|  |  |  	
 | 
	
		
			
				|  |  | -	let participantField=config.participantField;
 | 
	
		
			
				|  |  | +	//let participantField=config.participantField;
 | 
	
		
			
				|  |  | +	let participantField=config.formConfig.studyData["SubjectColumnName"];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	let dataObject=configUpload.queries[configUpload.queryId];
 | 
	
		
			
				|  |  |  	let queryName=dataObject.queryName;
 | 
	
	
		
			
				|  | @@ -1567,7 +1568,8 @@ function afterStudyUpload(configUpload,data){
 | 
	
		
			
				|  |  |  	//also updating existing rows, if they exist
 | 
	
		
			
				|  |  |  	for (let i=studyRows.length;i<listRows.length;i++){
 | 
	
		
			
				|  |  |  		let entry=listRows[i];
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | +		//make sure you have the participantField right
 | 
	
		
			
				|  |  | +		//
 | 
	
		
			
				|  |  |  		entry[participantField]=configUpload.participantId;
 | 
	
		
			
				|  |  |  		entry.crfRef=getCRFref();
 | 
	
		
			
				|  |  |  		entry.SequenceNum=getCRFref();
 | 
	
	
		
			
				|  | @@ -2288,6 +2290,20 @@ function afterUser(data){
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	let selectRows=new Object();
 | 
	
		
			
				|  |  |  	selectRows.containerPath=config.containerPath;
 | 
	
		
			
				|  |  | +	selectRows.schemaName='study';
 | 
	
		
			
				|  |  | +	selectRows.queryName='Study';
 | 
	
		
			
				|  |  | +	selectRows.columns="SubjectColumnName";
 | 
	
		
			
				|  |  | +	selectRows.success=afterStudy;
 | 
	
		
			
				|  |  | +	LABKEY.Query.selectRows(selectRows);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +function afterStudy(data){
 | 
	
		
			
				|  |  | +	config.formConfig.studyData=data.rows[0];
 | 
	
		
			
				|  |  | +	print("XSetting participantField to "+config.formConfig.studyData["SubjectColumnName"]);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	let selectRows=new Object();
 | 
	
		
			
				|  |  | +	selectRows.containerPath=config.containerPath;
 | 
	
		
			
				|  |  |  	selectRows.schemaName='lists';
 | 
	
		
			
				|  |  |  	selectRows.queryName='FormSetup';
 | 
	
		
			
				|  |  |  	selectRows.filterArray=[LABKEY.Filter.create('formName',config.formId)];
 |