Get LookupValue on New form

I want to create a Title based on the contents of two fields: the Year and the SCBA. Here is my code:

fd.spRendered(function() {
	let yr = new Date().getFullYear();
    fd.field('DropDown1').widget.setDataSource({data:[yr,yr + 1]});
	
	fd.field('DropDown1').$on('change', function(value) {
	    fd.field('Year').value = value;
		fd.field('Title').value = fd.field('SCBA').value.LookupValue + '-' + value;
	});
});

This works just fine after the form has been submitted once. The problem is getting the LookupValue on a new form returns blank. I tried to get at the text of the lookup field using the Widget object but I couldn't figure that out.

Hello @smithme,

How is the 'SCBA" field value set in the New Form? Is it set programmatically?

If it is, you can get value using pnpjs. Please see this post:

Sorry, that is important information you would need.

This form is a child form that is opened from a List control on the parent. It gets the SCBA value from the parent form.

@smithme,

In this case, you can either get SCBA value from the parent form:

fd.field('DropDown1').$on('change', function(value) {
        fd.field('Year').value = value;
        fd.field('Title').value = fd.field('SCBAParentForm').value.LookupValue + '-' + value;
});

Or get value with PNP JS.

pnp.sp.web.lists.getByTitle("ListName").items.filter("ID eq '" + fd.field('SCBA').value + "'").get().then(function(items) {

                console.log(items[0].Title);
   });