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

The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.

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

DKWc
14-Alexandrite

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
14-Alexandrite
(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
14-Alexandrite
(To:avillanueva)

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

Announcements

Top Tags