Custom Validations using Invisible FlexFields
Invisible Flexfields help perform validations of the build/deploy request before the form is submitted. Invisible FlexFields can be created for either the Deploy Request or Build Request and using the Validation Script to perform such logic.
We recommend using FLEX_FIELD_10 for performing Build or Deploy request related custom validations. You can do this for Build Request or Deploy Request or both.Â
- Make sure Active is set to Yes and Visible is set to No for FLEX_FIELD_10. You can do this with any FlexField, but choosing FLEX_FIELD_10 might help strictly for organizational purposes as you introduce more visible FlexFields in future.
- Select String as Data Type.
- Provide Code and Display Name, you can use something like DEPLOY_VALIDATION and Deploy Validation for Deploy Request and similarly BUILD_VALIDATION and Build Validation for Build Request.
- Configure Validation Groovy Script as necessary. See some examples below in this document.
- Make sure to click Save.
- You can reuse one invisible FlexField for many different validations.
 Â
Here are some samples of Validation script:
Require Start Time on Partial Deploy Deploy Request for EBS
if (PartialDeploymentsFlag && ProjectType!=null && ProjectType.equals("EBS")) { if(StartTime == null && "PROD".equals(EnvironmentCode)) { ValidationMessage="Please enter Start Time for deployment."; return false; } } return true;
Do not allow Deploy from Main Stream
if (MainStream) { ValidationMessage="Deployment not allowed from Main Stream."; return false; } return true;
The following macros are not currently supported in the footer:
- style