I know the experts will laugh at this question, but I'm really struggling. Please take a look at this snippet. I am very new to CRM and JavaScript.
So the issue is that it doesn't matter what I pick from the lookup list, it pops on the Alert. I can see where "incomplete" doesn't match the "complete" but it still fires the Alert.
Do I need to write an ODATA query to address this issue?
Function MPMain_OnChange() {
    try {
        //get the work order status.
        var wostatus = new Array();
        wostatus =Xrm.Page.getAttribute("workorderstatus").getValue();
        if (wostatus !=null) {
            var name = wostatus[0].name;
            if (name =="Completed") {
                alert("Order Complete");
            }
        }
    } catch {
        //there is an error.
    }
}
 
     
    
 
    