Fireevent or Onchange not working with Inject JS activity in uipath

I am trying to automate a webpage using uipath. It has two dropdowns as below


Upon selecting the Team, the Closure Category gets activated as below


While doing it with uipath, I have used try-catch block with selectors in try block and incase it fails, in catch block I am using JScript to achieve the task.

The Html code for this two dropdowns are as below:

    <select name="team" id="team" onchange="teamSelected();">
            <option value="-1" selected="">Select Team...</option>
            <option value="0">Game Security</option>
            <option value="1">Security</option>
            <option value="2" selected="true">Support</option>
            <option value="3">Responsible Gaming</option>
            <option value="4">Poker Room</option>

and the next one is

<select name="category" id="category" onchange="checkPermanentClosure();">
        <option value="-1">Select Closure Category...</option>
        <option value="9">Account Closure Request</option>
        <option value="10">Abuse - Offensive Language or Content</option>
        <option value="14">Approved User ID Change Request</option>
        <option value="16">Client Hacking</option>
        <option value="2">Colluder</option>

For injecting JScript I have written the below function

function SelectTeamForAccountClosure()
        for ( let i = 0; i < document.getElementById('team').children.length; i++)
            if ( document.getElementById('team').children[i].innerText == 'Support')
                document.getElementById('team').selectedIndex = i;

This function works perfectly when run inside the HTML Dom in Chrome, but uipath fails to trigger


I have also tried using


but it seems like uipath can not inject such java script and throwing error

TypeError: document.getElementById(...).onchange is not a function

It is same for fireEvent as well. Upon changing ContinueOnError to true, the error is not thrown but the work is also not done. It look like uipath can only change the selected index of the dropdown but can not call the onchange function.

Is there any way to achieve this using inject JS activity in uipath?