Skip to main content
Version: V2 (Ignition 8.1)

tamaki.mes.utils.showValidationsPopup

Description

Opens the TamakiMES/_popups/Validation modal popup, displaying validation failures as a markdown list. The validations argument is a mapping of field name to a list of failure messages; each field becomes a bold heading followed by its messages as bullet points.

Must be run in a Perspective session scope.

Syntax

tamaki.mes.utils.showValidationsPopup(validations)

Parameters

ParameterTypeNullableDescription
validationsDictFalseA mapping of field name to a list of failure messages, as returned by an MES validate function.

Returns

This method does not return a value. It opens the Validation popup as a side effect.

Code Examples

# Validate before saving; show the failures if there are any, otherwise save
try:
self.view.custom.success = None
inventoryOperation = dict(self.view.custom.inventoryOperation)
validations = dict(system.mes.inventory.operation.validateInventoryOperation(**inventoryOperation))
if validations:
tamaki.mes.utils.showValidationsPopup(validations)
else:
system.mes.inventory.operation.saveInventoryOperation(**inventoryOperation)
self.view.custom.success = True
tamaki.mes.utils.closeEmbeddedSidebar()
except Exception as e:
if not tamaki.mes.permissions.notifyUserIfPermissionException(e):
tamaki.mes.utils.showErrorPopup(e)
raise e