Use UI Extensions to Make CI Fields Required

 In Configuration Management, New Feature

UI ExtensionUI extensions are now able to make the following standard CI fields mandatory when the CI’s status is set to a specific option (e.g. ‘In Production’ or ‘Standby for Continuity’):

  • System ID
  • Service
  • Site
  • Location
  • Remarks
  • Attachments (at least one)
  • Nr. of processors
  • Nr. of cores
  • Nr. of licenses
  • Service instances (at least one)
  • Users (at least one)
  • Configuration items (at least one)
  • Contracts (at least one)
  • Supplier
  • Serial number
  • Financial owner
  • PO number
  • Asset ID
  • Depreciation method
  • Start date
  • Warranty expiry date

Below is an example of JavaScript code that can be added to a UI extension to make all these fields required when a user sets the status of a CI to either ‘In Production’ or ‘Standby for Continuity’. This JavaScript attaches an event handler to the Status field to get the current value of the CI’s Status field.

ITRP.field('status').on('change', function() {
  var required = ITRP.field('status').val() === 'in_production' || ITRP.field('status').val() === 'standby_for_continuity';
  ITRP.field('assetID').required(required);
  ITRP.field('attachments').required(required);
  ITRP.field('ci_relations').required(required);
  ITRP.field('contracts').required(required);
  ITRP.field('depreciation_method').required(required);
  ITRP.field('financial_owner').required(required);
  ITRP.field('location').required(required);
  ITRP.field('nr_of_cores').required(required);
  ITRP.field('nr_of_licenses').required(required);
  ITRP.field('nr_of_processors').required(required);
  ITRP.field('po_nr').required(required);
  ITRP.field('remarks').required(required);
  ITRP.field('serial_nr').required(required);
  ITRP.field('service').required(required);
  ITRP.field('service_instances').required(required);
  ITRP.field('site').required(required);
  ITRP.field('start_date').required(required);
  ITRP.field('supplier').required(required);
  ITRP.field('systemID').required(required);
  ITRP.field('users').required(required);
  ITRP.field('warranty_expiry_date').required(required);
}).trigger('change');

Once this JavaScript code example has been added to a UI extension, it can be linked to one or more products to ensure that all these fields of all CIs that are linked to those products become required when their status is set to ‘In Production’ or ‘Standby for Continuity’.

Product with UI extension that makes CI fields required

When one of the product’s CIs is set to one of these status values, it can no longer be updated in 4me’s user interface unless all those standard fields have a value.

CI with required standard fields

Because the UI extensions work in the user interface of 4me, the JavaScript is not applied when CI updates are made using the REST API, the Import API, or the Mass Update functionality.

NoteResource planning