Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A SIL condition which checks if due date is before current datethe day after tomorrow:

Code Block
titleSIL Code
return dueDate > (currentDate() + "2d");

More useful date routines can be found in the Date Routines section.

...

Code Block
titleSIL Code
string ROLE = "DevelopersAdministrators";
return isUserInRole(currentUser(),project, ROLE);

Only / Except users in custom field

A SIL condition that allows you to disable a particular transition when the current logged in user is in a multi user picker custom field (eg Team):

Code Block
titleSIL Code
return elementExists(Team, currentUser());

If you want the transition to be available to any user except the ones from the multi user picker cf Team, you have to negate the previous condition:

Code Block
titleSIL Code
return !elementExists(Team, currentUser());

Users in a field are/aren't in a project role

A SIL condition that makes a transition available only if all users in multi user picker custom field Team are in project role Developers:

Code Block
titleSIL Code
string ROLE = "Developers";
for(string user in Team) {
    if(!isUserInRole(user, project, ROLE)) {
       return false;
    }
}

If you want to disable the transition if at least one user from multi user picker cf Team is in role Administrators, use the following:

Code Block
titleSIL Code
string ROLE = "Administrators";
for(string user in Team) {
    if(isUserInRole(user, project, ROLE)) {
       return false;
    }
}

A custom field is/isn't initialized

A SIL condition that allows you to disable a particular transition if a custom field is not initialized:

Code Block
titleSIL Code
return isNotNull(customfield_10000);

If you want to disable the transition if field is initialized you should use:

Code Block
titleSIL Code
return isNull(customfield_10000);

Check user property

A SILcondition which checks if a user property has a certain value:

Code Block
titleSIL Code
string COUNTRY = "Romania";
return getUserProperty(currentUser(), "country") == COUNTRY;

Condition based on boolean expression

...