Workflow Condition using boolean custom field

Description
ovanpels
Posts: 3
Joined: Fri Apr 11, 2014 11:50 am

Workflow Condition using boolean custom field

Postby ovanpels » Fri Apr 11, 2014 12:33 pm

Hello forum,

I try to setup a new workflow one of our Polarion projects. At one step in the workflow I want to make sure, that the next status can only be reached, if a set of checkboxes (boolean custom fields) are all marked as "checked".

I tried to set the fields as "Required Fields" for the workflow action, but "checked" and "unchecked" both seem to fulfill this criteria. The boolean value is always set to either "true" or "false"...

The same problem appears, if I try to set the Workflow Condition "FieldNonEmpty". It looks fine for "untouched" WorkItems, but the workflow transition is allowed as soon as the boolean field was set for a specific workitem at some point in time... even if it was "unchecked" afterwards. Okay, this is what NonEmpty offers.

Are there any other options for taken the actual boolean value into account when deciding on allowed workflow actions?

Thanks for your input!

hseifert
Posts: 21
Joined: Wed Apr 17, 2013 12:10 pm
Location: Böblingen, Baden-Württemberg, Germany
Contact:

Re: Workflow Condition using boolean custom field

Postby hseifert » Tue Apr 15, 2014 7:26 am

Hello.

Unfortunately, you've probably done something wrong with your required fields attempt. We use at several states in the workflow Boolean fields and check whether they are activated. This works without any problems. :)

Could you try to configure this again? If it doesn't work, you can post the snippets (only the required snippets please) of your
  • custom-fields.xml
  • form-layout.xml
  • workflow.xml
here.
Kind regards.

Hagen

ovanpels
Posts: 3
Joined: Fri Apr 11, 2014 11:50 am

Re: Workflow Condition using boolean custom field

Postby ovanpels » Tue Apr 15, 2014 8:39 am

Hello Hagen,

thanks for your answer. I am happy to hear that my goal seems to be achievable...

My boolean fields all look like this: (They are defined for the specific Work Item Type on Project Scope.)

Code: Select all

<field description="Does the requirement name a metric to determine if the objectives are being met?" id="measurable" name="Measurable" type="boolean"/>


The form-layout.xml contains nothing special except the layout: (It is defined for the specific Work Item Type in the _default-Hat of this project.)

Code: Select all

           <panel description="SMART requirements">
              <field id="specific"/>
              <field id="measurable"/>
              <field id="attainable"/>
              <field id="relevant"/>
              <field id="traceable"/>
           </panel>


And the workflow action looks like this: (Again for the specific Work Item Type on Project Scope.)

Code: Select all

        <action id="accept" name="Accept">
            <roles>
                [...]
            </roles>
            <required>
                <field name="specific"/>
                <field name="measurable"/>
                <field name="attainable"/>
                <field name="relevant"/>
                <field name="traceable"/>
            </required>
        </action>


With this configuration there are two different situations:
  • new Work Items, where the boolean fields have never been touched: As soon as I select the Workflow Action the fields are marked as mandatory and I am not allowed to save without checking them. This is fine.
  • Work Items, where the boolean fields have been touched by setting them to checked, save, then setting them to unchecked again, and save: I can trigger the Workflow Action regardless of the boolean value of the required fields. The difference is, that now the workitem.xml contains the bolean field values (they are not empty, but set to false). This is the problem!

Is there something that I can do different? Any suggestion would be greatly appreciated.

Thanks for your time and thoughts,
Oliver

BTW: Our installation is still running Polarion ALM 2012 PRO, but I also tried this at http://almdemo.polarion.com/.

martins
Posts: 181
Joined: Thu Nov 05, 2009 3:24 pm

Re: Workflow Condition using boolean custom field

Postby martins » Wed Apr 16, 2014 7:24 am

Hello Oliver,

to achieve this you need to implement a workflow condition that checks if your custom field is set to "true". Unfortunately there's no out-of-the-box condition for this purpose implemented in Polarion.

The easiest way to implement an own workflow condition would be using the Polarion scripting tools and writing a simple script that checks the value of your custom field in a workflow condition, e. g.:

Code: Select all

var transitionPermitted = false;
var workItem = workflowContext.getWorkItem();
if(workItem.getValue("YOUR_CUSTOM_FIELD_ID")) transitionPermitted = true;
transitionPermitted;

Instead of using the scripting tools and a simple script you can also write an Java plugin that implements this functionality as a workflow condition.

Kind regards

Martin

hseifert
Posts: 21
Joined: Wed Apr 17, 2013 12:10 pm
Location: Böblingen, Baden-Württemberg, Germany
Contact:

Re: Workflow Condition using boolean custom field

Postby hseifert » Thu Apr 17, 2014 7:39 am

martins wrote:to achieve this you need to implement a workflow condition that checks if your custom field is set to "true". Unfortunately there's no out-of-the-box condition for this purpose implemented in Polarion.


Shame on me. :( You are right. We never change an activated Boolean field, so this works for us. Sorry for my wrong answer.
Kind regards.

Hagen

ovanpels
Posts: 3
Joined: Fri Apr 11, 2014 11:50 am

Re: Workflow Condition using boolean custom field

Postby ovanpels » Thu Apr 17, 2014 8:47 pm

Hello Martin,

thank you for pointing me into the right direction. Polarion Scripting seems to be quite a powerful extension, but I prefer the plugin method for less worries about unwanted access or side-effects. The scripting plugin will be a good reference to start with.

And @hseifert: It is a shame that this is not available out-of-the-box. I think the default behaviour of "required fields" is even misleading in this case. So don't worry, thanks for your input anyways.

Best Regards
Oliver


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 6 guests