FlexFields provide a powerful mechanism for capturing customer specific information and/or injecting custom validation logic. Chandresh wrote a blog article some time ago showing how FlexFields could be configured for a deployment request. Since he wrote that blog new features have been added to make FlexFields even more powerful.
- Build Request FlexFields (4.0.3 )
- Invisible FlexFields (4.0.3 – patch release 5/22/2017)
Build Request FlexFields bring the same features as Deploy Request FlexFields, and apply to submissions of builds. That is, allowing for capture/validation of information (and validating it through custom scripting) at build request time. The Build Request FlexFields are defined under Administration -> FlexFields.
The FlexField definition contains a number of configuration options which allow you to tailor the process to meet your requirements, including:
- Define data type
- Define whether the field is required or not
- Provide a list of values for user to select from
- Default the value using a Groovy Script
- Add custom validation logic using a Groovy Script
A new FlexField configuration option was recently added for both Build and Deploy Request FlexField, allowing it to be marked as invisible. What is the point of a custom field if the user cannot enter a value? This is a powerful mechanism, as it allows a hook to inject custom validation on the request forms without displaying a new field to the user. There are many use cases that come to mind, but here are a few examples and sample scripts.
Require Package Name on Partial Deploy Build Request for EBS
if (PartialDeploymentsFlag && ProjectType!=null && ProjectType.equals("EBS") && (PackageName==null || PackageName.equals(""))) { ValidationMessage="Package Name is required"; return false; } return true;
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;
Every organization’s processes for delivering software differs, often an evolution of years of refinement. FlexDeploy provides out of the box capabilities to deliver best practices and capitalize on the value of DevOps. FlexFields, and many other extension points, offer the flexibility to design the process that is right for you.