item is undefined in SharePoint Online but works fine in SharePoint 2013

Long story short I’m migrating SP2013 to SPO. Unfortunately the code is producing an error in the browser console that collListItem is undefined.

All I did was to replace the addresses where needed with the new ones including the imports of jQuery and other resources. The page itself has search functionality which is working fine and a list of letters to pick from (like a dictionary) to check manually for a given word. Upon selecting some of the letters nothing is displayed. After clicking the edit page button all the words are loaded.

I read that this is common issue and the solution was to use SP.SOD.executefunc. Much to my regret this doesn’t seem to work. Last but not least this is just a small excerpt of the code. To keep it tidy I removed the html/css bits and some of the other functions where collListItem is also used but no problems there.

Any suggestions are welcome.

$("#btnSearch").click(function () {
    
    $('#dispRecs').remove();
    $('#nav').remove();
    //$("#spAcronym").text('');
    //$("#spDefinition").text('');
    //$("#spTerm").text('');
    //$("#spDate").text('');
    var txtsTerm = $("#txtSearch").val();
    
    $("#MatchText").empty();
    if($.trim(txtsTerm)!='')
    {
        var letter=$.trim(txtsTerm).substring(0,1);
        $('.aClick').removeClass('aClick');
        $('#'+ letter).addClass('aClick');
        
        //ExecuteOrDelayUntilScriptLoaded(retrieveListItems, "sp.js"); 
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', retrieveListItems);
}
else{
$("#MatchText").hide();
$("#noMatchText").hide();
$("#defaultText").show();
$('#alphaSearch').hide();
}

 });
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', retrieveautotextItems);
function retrieveautotextItems() {
        var siteUrl = 'https://contoso.com/sites/';
        var clientContext = new SP.ClientContext(siteUrl);
        // Get the list instance
        var oList = clientContext.get_web().get_lists().getByTitle('Term');


        var camlQuery = new SP.CamlQuery();

        var strQuery='';        
        
        strQuery="<View><Query><Where><And><Eq><FieldRef Name='IsActive'/><Value Type='Integer'>"+ "1" +"</Value></Eq><Neq><FieldRef Name='Term'/><Value Type='Text'>"+ "" +"</Value></Neq></And></Where></Query><RowLimit>1000</RowLimit></View>";
        
        //alert(strQuery);
        camlQuery.set_viewXml(strQuery);
        
        this.collListItem = oList.getItems(camlQuery);

        clientContext.load(this.collListItem);

        clientContext.executeQueryAsync(Function.createDelegate(this, this.onQueryAutoSucceeded), Function.createDelegate(this, this.onQueryAutoFailed));        

    }
    ```