Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hi All,
Could we make comments field mandatory in a workflow task depending on routing option chosen.
For example:
A task has Approve and Rework option. If user chooses Rework option comments should become mandatory. If chooses Approve its not mandatory.
Any inputs how we can achieve this.
Thanks in advance.
Regards,
DK.
Yes you can make comments as mandatory. Refer this,
https://www.ptc.com/en/support/article/CS35488
Hi thanks for replying.
I'm looking for comments to become mandatory depending on the routing option chosen.
function validate_Complete()
{
var c=document.getElementsByTagName("textarea")
var comment;
for (var k=0; k<c.length; k++)
{
if (c[k].name.indexOf("comments")!=-1)
{
comment=c[k];
break;
}
}
var vote;
var a=document.getElementsByTagName("input");
var voteField = new Array(3); //assumption, only three choices
//get vote choices
var counter=0;
for (var i=0; i<a.length; i++)
{
if (a[i].name.indexOf("WfUserEvent0")!=-1)
{
voteField[counter++]=a[i];
}
}
vote = getCheckedValue(voteField)
if (vote =="Reject" || vote == "Amend")
if (IsEmpty(comment))
{
alert("Please enter comments if you are choosing Amend or Reject.");
return false;
}
return true;
}
Note that PTC solution would apply to ALL tasks. I changed the complete button JSP page to only invoke this if I am using a custom task form template. A simpler solution might be to add a condition to the code above that checks the task name or other attributes so it only applies to the workflow task you care about.
Thanks that completely makes sense, defining only the task you care about.