We need to use the setValue() method to set values to an attribute. This method allows you to set values of many data types (text, numeric, date/time, boolean, etc.)
Setting value
# Setting string value
mbo.setValue("DESCRIPTION", "new description")
# Setting numeric value
mbo.setValue("PRIORITY", 2)
mbo.setValue("REPLACECOST", 2463.80)
# Setting date value
from psdi.server import MXServer
mbo.setValue("INSTALLDATE", MXServer.getMXServer().getDate())
# Setting boolean value
mbo.setValue("ISRUNNING", False)
Setting value with modifiers
To set values with modifiers, do the following:
from psdi.mbo import MboConstants
mbo.setValue("DESCRIPTION", "new description", MboConstants.NOACCESSCHECK)
mbo.setValue("DESCRIPTION", "new description", MboConstants.NOVALIDATION)
mbo.setValue("DESCRIPTION", "new description", MboConstants.NOACTION)
mbo.setValue("DESCRIPTION", "new description", MboConstants.NOVALIDATION_AND_NOACTION)
mbo.setValue("DESCRIPTION", "new description", MboConstants.NOVALIDATION_AND_NOACTION_ALLOWCROSSOVER)
For more information about modifiers constants, you can review my post “Common MboConstants when coding in MAXIMO“.
If you found my post interesting or useful and just want to say thanks, you can always buy me a coffee.



