Planned Maintenance Schedule Bug in Field Service Management

jmattw
Tera Contributor

I believe I found a couple of bugs in the Field Service Management Module that causes Maintenance Schedules not to run if the trigger is set to "Condition" or "Script". Since I don't have HI access, I'm posting here. If you try to run the maintenance schedule, either "on Demand" or as part of the "Planned Maintenance Nightly Run" scheduled job, you will see the following error in the script log statements:

 

PlannedMaintenanceExtPoint: createOrdersByPlanRecords - {0}: ReferenceError: "m2mGr" is not defined.

 

I traced the bugs to the following Script Include "PlannedMaintenanceExtensionPointImpl".

 

The affected functions are "createOrderForConditionSchedulePlanRecord" and "

createOrderForScriptSchedulePlanRecord"

 

To illustrate, here is the "createOrderForConditionSchedulePlanRecord" script:

 

 

createOrderForConditionSchedulePlanRecord : function (planRecord) {
var tableName = planRecord.document_table;
if(JSUtil.nil(tableName)) {
tableName = planRecord.schedule.plan.table;
if(JSUtil.nil(tableName)) {
gs.error("Planned Maintenance: Skipping Schedule = " + m2mGr.getDisplayValue('schedule') + ". No table found on schedule or plan record.");
return;
}
}
var assetGr = new GlideRecord(tableName);
if (!assetGr.isValid()){
return;
}
assetGr.addQuery("sys_id", m2mGr.source_id);
assetGr.query();
if (assetGr.next()) {
var filter = new GlideFilter(planRecord.schedule.filter_condition, "filter_condition");
filter.setCaseSensitive(false);
if (filter.match(assetGr, true)) {
this._createOrder(m2mGr);
}
}
},

 

 

The error is the same in both functions. Note there is no m2mGr declared in the function, which correlates to the error message above. By replacing "m2mGr" with "planRecord" the Maintenance Plan Schedules will run as expected.

 

My PDI is  on glide-washingtondc-12-20-2023__patch1-02-28-2024 (although I'm currently upgrading).

 

Thanks,

 

Matt

1 REPLY 1

Bert_c1
Kilo Patron

post steps-to-reproduce, and maybe someone here will try to duplicate. However, you need to create a Support Case (which you state you can't do) to verify any 'bug'.