Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi all,
I have to create a check box in the change activity with string type and until the check box is ticked the complete task button should be disabled. please find the attached image for reference.
can anyone please provide a solution for this?
Hi @AK_10813265
You can add an WF variable and check if the variable is set to true in the complete task transaction.
The user will be informed that something is wrong.
if you need to return error message in the task completion transition use following code
String msg = "Can not complate the task without checking the check box";
java.lang.Exception exp = new java.lang.Exception(msg);
throw exp;
here is an example with required task comment
CS152927 - How to validate that the "Comments" field is not empty
you can use this alternative technique for your parameter
PetrH
hi,
thanks for the solution,
for creating wf variable here, should it be boolean variable or string variable? and in the display name i need that sentence which i had attached in the image, can you please tell me how to get that?
Thanks
Ak
Hi @AK_10813265
Test it. If you use string, how do you think it would be displayed? As a input field i guess.
Try to use boolean.
Try to put the sentence to the display name of the attribute.
maybe there could be different way how to put there so long text.
PetrH
Hi @HelesicPetr ,
I tried creating a boolean variable, but i'm not getting the variable in the change activity page, please find the below screenshots
and let me know where did i go wrong?
Hi @AK_10813265
You need to update Task form Template
https://www.ptc.com/en/support/article/CS283680
https://www.ptc.com/en/support/article/CS133197
Task form template resources
https://www.ptc.com/en/support/article/CS361463
PetrH
Hi @HelesicPetr ,
Thanks for the solution,
Now I have created the variable and check box is appearing as expected in the task page. there is an additional requirement which is
there are 2 routing options, out of which for "Completed" routing option once selected it should not complete the task after clicking "Complete task" button until and unless the check box is selected. but where as the "Return_to_project_owner" routing option once selected even if the check box is not selected it should be allowed to complete the task.
till now I have this code is handy , which will not allow until the check box is selected but i wanted with routing option condition
public static Object[] criticalitytraceabilitycheck(Object result, boolean Criticalitycheck) throws Exception {
System.out.println("Enter WFT_PolEntChangeActivity.criticalitycheck --> ");
if (Criticalitycheck == false){
result = false;
String msg = "To complete the task, Please select check box";
java.lang.Exception exp = new java.lang.Exception(msg);
throw exp;
}
else {
result = true;
}
Object[] wfAutoExternResult = {result};
return wfAutoExternResult;
}
can you please help me on this for the code?
Hello @AK_10813265,
It looks like you have some responses from a community member. If any of these replies helped you solve your question please mark the appropriate reply as the Accepted Solution.
Of course, if you have more to share on your issue, please let the Community know so other community members can continue to help you.
Thanks,
Community Moderation Team.