Hello mates,
I hope you 're all doing well, I am facing a situation that I have never encountered before
I would like to set a field required based on a condition ? I started writing a JS code but dont know if its correct or no
My requirement is to set the field "nameofsd" as required if the field "taskproject" is equal to "finished" or "finished" and if the field "team" is equal to "Team 1" or "Team 2" or "Team3"
function
setFieldrequirementasrequired(executionContext)
{
// Getting formContext
var
formContext = executionContext.getFormContext();
var
task = formContext.getAttribute(
"new_taskproject"
).getValue();
var
team = formContext.getAttribute(
"new_projectteam"
).getValue();
if
(task == "finished" || "signed" && team= "Team1" || "Team2" || "Team3")
{
formContext.getAttribute(
"nameofsd"
).setRequiredLevel(
"required"
);
}
else
{
//setting Email field requirement as none.
formContext.getAttribute(
"nameofsd"
).setRequiredLevel(
"none"
);
}
}
Thanks in advance mates :)