Hello,
I have been trying to validate a form Lookup field but it just doesnt seem to work, I have tried many ways in the Javascript and nothing, it just doesn't seem to work, Basically
I need to verify one field on the form of case, if that field has a Determined text another field gets blocked if not the other field is enabled, this seems pretty basic but everytime I try to do it nothing happens, I have even tried with a normal text on an Alertin the browser and it doesn't work either. I'm just starting with Dynamics 365 and I'm not really sure if I'm doing something wrong when loading the JS, The event handler is created in the field itself (the one I need to capture the text ) and is an onChange type, I'm not really sure if I need to add other parameters but so far it hasn't worked.
this is the code of the Script:
function serviceType(executionContext) { debugger; var formContext =executionContext.getFormContext(); var serviceType = formContext.getAttribute("c9_caseservicetype"); if (serviceType != null) { var text = serviceType[0].name; if(text == "TM"){ formContext.getControl("c9_contract").seDisabled(true); } } }
As you can see the functionality I'm looking for is quite simple but I can't get it to work, maybe I can accomplish the same with business rules but I just want to learn how to apply scripts for harder modifications that might be not possible with business rules. Any help will be appreciated.
Thanks in advance.