...
// Delete the following lines.
IF ServItem.GET(ServItemLine."Service Item No.") THEN BEGIN
TroubleshootingSetup.RESET;
TroubleshootingSetup.SETRANGE(Type,TroubleshootingSetup.Type::"Service Item");
TroubleshootingSetup.SETRANGE("No.",ServItemLine."Service Item No.");
EXIT(TroubleshootingSetup.COUNT);
END;
// End of the deleted lines.
...
...
//Add the following lines,
TroubleshootingSetup.RESET;
TroubleshootingSetup.SETRANGE(Type,TroubleshootingSetup.Type::"Service Item");
TroubleshootingSetup.SETRANGE("No.",ServItemLine."Service Item No.");
IF NOT TroubleshootingSetup.ISEMPTY THEN
EXIT(TroubleshootingSetup.COUNT);
IF NOT ServItem.GET(ServItemLine."Service Item No.") THEN
EXIT(0);
TroubleshootingSetup.SETRANGE(Type,TroubleshootingSetup.Type::Item);
TroubleshootingSetup.SETRANGE("No.",ServItem."Item No.");
IF NOT TroubleshootingSetup.ISEMPTY THEN
EXIT(TroubleshootingSetup.COUNT);
TroubleshootingSetup.SETRANGE(Type,TroubleshootingSetup.Type::"Service Item Group");
TroubleshootingSetup.SETRANGE("No.",ServItem."Service Item Group Code");
EXIT(TroubleshootingSetup.COUNT);
// End of the added lines.
...