Dear all,
I'm trying to implement a JS rule code to set a field as mandatory or not, below the code that i am using, but unfortunately not working, do you have any idea where it is not working ?
new_projecttask = drop down list values
msdyn_projectteamid = relation lookup field
new_fieldtobemandatoryornot = Free text
function setFieldrequirementasrequired(executionContext)
{
var formContext = executionContext.getFormContext();
var task = formContext.getAttribute("new_projecttask").getValue();
var team = formContext.getAttribute("msdyn_projectteamid").getValue();
if ((task == "698 690 007" || task== "100 000 000" || task== "698 690 008") && (team[0].name= "TeamName1" || team[0].name== "TeamName2" || team[0].name== "TeamName3"))
{
formContext.getAttribute("new_fieldtobemandatoryornot").setRequiredLevel("required");
}
else
{
formContext.getAttribute("new_fieldtobemandatoryornot").setRequiredLevel("none");
}
}
Thanks and happy new year :) .
Regards,