JJupin - Auto transition a task after validating that custom fields are not empty.

Avril Bower
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 18, 2016

Hello, 

I have a problem with an autotransition that's been requested. I have attempted to design the workflow two different ways and neither has worked. 

Design 1: 

The Status 'Waiting for training date confirmation' has five statuses. As follows: 

  1. Training date confirmed
    1. moves the status to 'Waiting for WebEx creation'
    2. no screen
    3. Hidden from user in the conditions to be uses for the auto-transition
  2. PDM approval
    1. status remains the same
    2. transition button to only be shown if the corresponding custom field is null (set in conditions) 
  3. TDU approval
    1. status remains the same
    2. transition button to only be shown if the corresponding custom field is null (set in conditions) 
  4. EU approval 
    1. status remains the same
    2. transition button to only be shown if the corresponding custom field is null (set in conditions) 
  5. Intl. approval
    1. status remains the same
    2. transition button to only be shown if the corresponding custom field is null (set in conditions) 

The four approval transitions have no screens and are meant to be removed from the screen once they have been executed by various users and can be executed in any order.

They each also have a post function that filles in the date/time of their corresponding custom field, like so: 

 image2016-2-18 13:26:32.png

I have placed the same sil script on each of the four approval transitions as a post function:

//To autotransition the task to 'Training Date Confirmed' status after verifying that PDM, TDU, EU, & Intl. approvals have a date value. 
if (isNotNull("Training date PDM approval") && isNotNull("Training date TDU approval")&& isNotNull("Training date EU approval") && isNotNull ("Training date Intl. approval")){
    autotransition("Training date confirmed", key);
}

Problems: 

  1. The auto-transition will not fire if the 'Training date confirmed' transition is hidden
  2. If I un-hide the 'Training date confirmed' transition the script will not validate that the custom fields have a value. they will simply advance to the next status.

Design 2: 

Like the design above but with the following changes.

I removed the transition 'Training date confirmed', the four approval statuses remain. 

The approval statuses will now move the task to the next status instead of remaining the same

The sil script post function reads like the following (depending on which transition that it is attached to): 

//To autotransition the task to 'Training Date Confirmed' status after verifying that PDM, TDU, EU, & Intl. approvals have a date value. 
if (isNotNull("Training date TDU approval")&& isNotNull("Training date EU approval") && isNotNull ("Training date Intl. approval")){
    autotransition("PDM approval", key);
}
else
{
    status = {"Waiting for training date confirmation"};
}

For example the above script is the post function for PDM approval only but the script for TDU approval will look  like this: 

//To autotransition the task to 'Training Date Confirmed' status after verifying that PDM, TDU, EU, & Intl. approvals have a date value. 
if (isNotNull("Training date PDM approval")&& isNotNull("Training date EU approval") && isNotNull ("Training date Intl. approval")){
    autotransition("TDU approval", key);
}
else
{
    status = {"Waiting for training date confirmation"};
}

Problem: 

  1. The script will still not validate that the custom fields have a value or not. It will simply advance to the next status. 

Any assistance you can provide or another way of designing this would be greatly appreciated. I've been fighting with this for about three weeks now, trying different things, but nothing I try is working. 

 

Thank you, 

 

Avril 

 

1 answer

0 votes
Alexandra Topoloaga
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2016

Hi,

 

First of all, isNotNull routine expects the parameter without quotes.

Secondly, we have another routine, hasInput, which does pretty much the same think as "isNotNull", but is specific for postfunctions and validators.


Try to use

isNotNull(Training date PDM approval)

or

hasInput("Training date PDM approval")

Both of them should work.

Hope this helps,
Alexandra 

Avril Bower
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2016

Hi Alexandra, 

Thank you for your response. I tried both of your suggestions. When I removed the quotes for the isNotNull, SIL Manager gave me lots of errors on the syntax. 

I then switched out isNotNull with the hasInput.

Design 1: 

It seems like the script is validating the values but it will not fire the auto-transition either when the 'Training date confirmed' transition is hidden or not. 

Design 2: 

The values are still not validated. The task will transition regardless. 

Any other suggestions?

Thank you, 

Avril 

Alexandra Topoloaga
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2016

What version of JJUPIN are you using? I guess the errors from the SIL Manager are because in your case, the name of the custom field contains spaces. Could you try to add an alias to that field and re-check it?

Avril Bower
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 25, 2016

Hi Alexandra, 

I'm using version 3.0.10. I tried your suggestion using an alias no go. I get the following in the logs: 'Training date confirmed' Not hidden from user in conditions. 

2016... /rest/keplerrominfo/jjupin/latest/lf/initPage
[commons.ivm.postactions.TransitionPostAction] Transition not found. Cannot
execute autotransition().

'Training date confirmed' Hidden from user in conditions: 

2016... /rest/keplerrominfo/jjupin/latest/lf/initPage
[jira.commons.ivm.IssueVariableResolver] Script is not running in the context of an issue.Cannot get value for field key


Alexandra Topoloaga
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 1, 2016

Hi,

 

So you've added in silalises file some lines like this, isn't it?

customfield_10604=dt1;

 

If you now use in your postfunction 

isNotNull("dt1")

what happens? 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events