Original Message:
Sent: Wed May 17, 2023 08:14 AM
From: Thi Minh Man Nguyen
Subject: Automation Script Maximo 7.6.1.2 - Object Launch Point Script "saved"
Hi Mohammad,
I think the error prompt related to the setWhere. Since the mEmpno is a variable, it shouldn't be in the quote ''.
Try instead:
mTS.setWhere (" ZZEMPLOYEENO= '" +mEmpno+ "'")
------------------------------
Thi Minh Man Nguyen
Original Message:
Sent: Wed May 17, 2023 03:26 AM
From: mohammad moula
Subject: Automation Script Maximo 7.6.1.2 - Object Launch Point Script "saved"
Hi Suhas,
Thanks for your help
I wrote what you did as follows :
.
and I got the following error:
Original Message:
Sent: 5/17/2023 1:38:00 AM
From: Suhas Joshi
Subject: RE: Automation Script Maximo 7.6.1.2 - Object Launch Point Script "saved"
Hi Mohammad,
Try below:
mTS = mbo.getMboSet("VACTIMESHEET")
mTS.setWhere("CLOCK_IN='"+mVacstart+"'")
mTS.reset()
if not (mTS.isEmpty()):
mTSmbo=mTS.getMbo(0); #I am using getMbo(0) assuming it will return only 1 record. If it returns multiple, you will have to loop through using while loop
if mTSmbo.isNull("CLOCK_IN"):
#do your logic
else:
#do your logic
mVacstart = mbo.getDate("VACATION_STAT") #&& this is mapped to CLOCK_IN , on AMSTIMECARD
mVacend = mbo.getDate("VACATION_END") #&& this is mapped to CLOCK_OUT , on AMSTIMECARD
mTmesheet = mTS.add()
mTmesheet.setValue("CLOCK_IN",mVacstart)
mTmesheet.setValue("CLOCK_OUT",mVacend)
------------------------------
Suhas Joshi
Original Message:
Sent: Tue May 16, 2023 12:19 AM
From: mohammad moula
Subject: Automation Script Maximo 7.6.1.2 - Object Launch Point Script "saved"
Helo all of you,
I created an automation script as follow:
- Object Launch Point = AMSVACTRANS
- Events = Save ( Add, Update)
- AMSVACTRANS object has a relationship with another object called AMSTIMECARD through a named relationship = VACTIMESHEET.
So, the current mbo is AMSVACTRANS and I need to search for a record on VACTIMESHEET which is the zzempoyeeno.
I wrote the following to search:
mTS = mbo.getMboSet("VACTIMESHEET")
mTS.setWhere(CLOCK_IN"+'mVacstart')
if mTS.isNull("CLOCK_IN"):
else
' not exists , add new record
mVacstart = mbo.getDate("VACATION_STAT") && this is mapped to CLOCK_IN , on AMSTIMECARD
mVacend = mbo.getDate("VACATION_END") && this is mapped to CLOCK_OUT , on AMSTIMECARD
mTmesheet = mTS.add()
mTimesheet.setValue("CLOCK_IN",mVacstart)
mTimesheet.setValue("CLOCK_OUT",mVacedn)
then I got error message CLOCK_IN does not exist !
Whhile "CLOCK_IN" is an attribute on AMSTIMECARD ??
Any help to find records through the relationship ?
Thanks
------------------------------
mohammad moula
------------------------------
#MaximoIntegrationandScripting
#Maximo