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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Complete task button to be disabled using workflow variable

AK_10813265
10-Marble

Complete task button to be disabled using workflow variable

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?

8 REPLIES 8

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;

 

Complete Task Transition

Error Handling in Transitions

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 ,

 

Yes, will test and let you know on this...

 

Regards,

Akhil Kulkarni

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?

 

AK_10813265_0-1716812663863.png

AK_10813265_1-1716812709268.pngAK_10813265_2-1716812930113.png

 

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.

 

AK_10813265_0-1717669740014.png

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.

Announcements

Top Tags