cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Can we make comments mandatory in workflow task depending on routing option.

DKWc
13-Aquamarine

Can we make comments mandatory in workflow task depending on routing option.

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.

5 REPLIES 5
ANNA_02
13-Aquamarine
(To:DKWc)

Yes you can make comments as mandatory. Refer this,
https://www.ptc.com/en/support/article/CS35488

 

DKWc
13-Aquamarine
(To:ANNA_02)

Hi thanks for replying.

I'm looking for comments to become mandatory depending on the routing option chosen.

HelesicPetr
22-Sapphire I
(To:DKWc)

Hi @DKWc 

So write a condition that checks the routing choices

PetrH

avillanueva
22-Sapphire II
(To:DKWc)

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. 

DKWc
13-Aquamarine
(To:avillanueva)

Thanks that completely makes sense, defining only the task you care about.

Top Tags