AshishKM
Kilo Patron

Hi @Alan42 , 

Update the UI Type = All and add an alert method for "availableHours" to check the return value on portal.

 

AshishKM_0-1719606370649.png

 

function onLoad() {
    var userEmail = g_user.email;
    var ga = new GlideAjax('VacationHoursFetcher');
    ga.addParam('sysparm_name', 'getVacationHours');
    ga.addParam('email', userEmail); // Ensure this parameter matches what the Script Include expects
    ga.getXMLAnswer(function(response) {
        var availableHours = response.responseXML.documentElement.getAttribute('answer');
        alert("availableHours-->"+availableHours);        
        g_form.setValue('vacationbalance', availableHours); // Ensure this field ID is correct
    });
}

-Thanks,

AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution