Skip to main contentMAF Configuration Practices

Restrict Work Order Priority Based On Work Type

About this task

This guide instructs on how to add new priority domain to the system and use it to prioritize work orders. It also describes how to implement a condition to remove the Priority 5 option from the lookup when creating and editing work orders if their work types are other than preventive maintenance (PM)

Procedure

Step 1: Follow the practice below to create a query, create a datasource to load the data and declare a new lookup.

Step 2: Declare the dialogOpened method to handle the window opening event. The code inside the method should contain the verification of the name of the dialog that was opened, the existence of the datasource and the confirmation of the current page before executing the filter. Insert the following logic in the method:

dialogOpened({dialog}) {
// page name when dialog is open
this.app.log.d(TAG,`dialog ${dialog?.name} opened at ${this.app.currentPage.name} page`);
if (dialog?.name === 'trg_woPriorityLookup' && ['woedit'].some(page => page === this.app.currentPage.name)) {
// Check status domain datasource existence
const priorityLookupDS = this.app.findDatasource('trg_WoPrioritylookupDS');
if (!priorityLookupDS) {