Skip to main content
Version: V2 (Ignition 8.1)

system.mes.location.newLocation

Description​

Generates an empty non-persisted Locations object to provide the structure required by the API to save a new record into the database. This method must be combined with the saveLocation method in order to persist the record.

Permissions​

This method does not require any permissions.

Syntax​

system.mes.location.newLocation()

Parameters​

ParameterTypeNullableDescription
None--This method does not take any parameters.

Returns​

Returns a JSON representation of the newly created location object. The following is a list of keys and default values:

KeyDefault Value
namenull
descriptionnull
parentIdnull
typeENTERPRISE
processTypeNONE
sortOrder0
allowNegativeInventoryfalse
storageCapacitynull
storageCapacityUnitIdnull
lotStorageStrategyNO_STORAGE
lotUseStrategyFIFO
pathnull
idnull
notesnull
enabledtrue
spare1null
spare2null
spare3null

Code Examples​

# Generate the object structure for a new location object with no initial arguments
newLocation = system.mes.location.newLocation()

# Set basic attributes for the new location
newLocation['name'] = 'NewLocation'
newLocation['description'] = 'A new location created via script.'
# (You can continue setting other properties as needed here)

# Save the new location to the system
savedLocation = system.mes.location.saveLocation(**newLocation)

# Output the JSON representation of the saved location
print(savedLocation)