Set Field value with URL

I'm trying to set a link to preset a field on my form. For example if they click "Oracle ticket", it opens the form with Oracle already populated. (This field is a choice, drop down list)
I found a post saying to use This code:
fd.rendered(function() {
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
// Replace SingleLineText0 with teh internal name of the field
// 'id' is the name of the parametr
fd.field('Case_x0020_Category').value = urlParams.get('id');
});
And the URL I add &id=1 and nothing happens. I have 2 form sets and I have set the JS on both of them and still can't get it to trip.

Here is the URL I'm using with the domain X'ed out.

https://XXXXX.sharepoint.com/sites/IT/SitePages/PlumsailForms/Helpdesk/Item/db243774-a42d-4810-809f-39c56b4e5e5c/NewForm.aspx#/?spform-List=9a332e69-56eb-461a-86c1-b1781d2b6227&Source=https%3A//XXXXX.sharepoint.com/sites/IT/Lists/Helpdesk/AllItems.aspx&ContentTypeId=0x0100C879F47B6EABDB4483A21375DF4B8722&RootFolder=/sites/IT/Lists/Helpdesk&id=1

Hello @madjk07,

First, you need to remove #/ from the URL:
4e5e5c/NewForm.aspx #/ ?spform-List=9a332e69-56eb-461a-86c1-

And if you are using forms for SharePoint, you need to run your code under spRendered event, like this:

fd.spRendered(function () {
    const queryString = window.location.search;
    const urlParams = new URLSearchParams(queryString);
    // Replace SingleLineText0 with the internal name of the field
    // 'id' is the name of the parametr
    fd.field('Case_x0020_Category').value = urlParams.get('id');
});