Hi All,
I have been working on a script that auto creates a labor record when a new user is created. Here is the manual process I follow today:
- I manually create a new a User in MAS (This process will stay the same).
- New User record is automatically created in Manage.
- New Person record is automatically created in Manage.
- I manually create the user's labor record in Manage.
The auto script below successfully creates a new labor record when I manually create a Person record. However, when a new user is created through MAS and the person record is automatically created, the script does not run. Could someone please assist?
from psdi.mbo import MboConstants
# Get the personid value from the person object
# Check if the personid record is newly created (isNew() method checks if the record is new)
if mbo.isNew():
personid = mbo.getString("PERSONID")
# Check if the personid is not empty
if mbo:
# Get the Labor object and create a new labor record
# Get the LaborCraftRate object and create a new laborcraftrate record
laborSet = mbo.getMboSet("$LABOR", "LABOR", "1=0") # Create an empty labor set
labor = laborSet.addAtEnd()
laborCraftRateSet = labor.getMboSet("$LABORCRAFTRATE", "LABORCRAFTRATE", "1=0") # Create an empty laborcraftrate set
laborCraftRate = laborCraftRateSet.addAtEnd()
# Set the labor id to match the personid
# Set the craft code and laborcode values for the laborcraftrate record
labor.setValue("LABORCODE", personid)
laborCraftRate.setValue("CRAFT", "MAINT")
laborCraftRate.setValue("LABORCODE", personid)
laborCraftRate.setValue("DISPLAYRATE", "35")
# Save the labor record
laborSet.save()
# Save the laborcraftrate record
laborCraftRateSet.save()
#MaximoApplicationSuite------------------------------
Carlos Mestre
Home Depot
------------------------------