Hi,
I have a custom table (CXPERSON) which has fields EMAIL, OTHEREMAIL1 and OTHEREMAIL2. The custom table will hold email address only any one of the fields ( not necessarily all the 3). For example
Scenario 1 - CXPERSON.EMAIL is not null then this value should be copied over to EMAIL.EMAILADDREESS ,
Scenario 2 - CXPERSON.EMAIL is NULL and CXPERSON.OTHERMAIL1 is not null then this value should be copied over to EMAIL.EMAILADDRESS.
Scenario 1 works without any issue however Scenario 2 gives the following error . I'm unable to figure out what could be the problem
The script is invoked on action launch point in the custom table CXPERSON and moved to the PERSON table.
personMboSet = mbo.getMboSet("CXPERSON")
if personMboSet.count()>0:
personMbo = personMboSet.getMbo(0)
emailMboSet = personMbo.getMboSet("EMAIL")
if emailMboSet.isEmpty():
emailMbo = emailMboSet.add()
emailMbo.setValue("PERSONID", mbo.getString("PERSONID"))
if mbo.getString("EMAIL") is not None:
emailMbo.setValue("EMAILADDRESS", mbo.getString("EMAIL"))
elif mbo.getString("OTHERMAIL1") is not None:
emailMbo.setValue("EMAILADDRESS", mbo.getString("OTHERMAIL1"))
emailMboSet.save()
personMboSet.save()
BMXAA6696E - The required field validation in the MBO failed for object EMAIL and attribute EMAILADDRESS. MXAA4195E - A value is required for the E-mail field on the EMAIL object.
psdi.util.MXRequiredFieldException: BMXAA4195E - A value is required for the E-mail field on the EMAIL object.
at psdi.mbo.Mbo.throwRequiredException(Mbo.java:4938)
at psdi.mbo.Mbo.validate(Mbo.java:4742)
at psdi.mbo.MboSet.validate(MboSet.java:5400)
at psdi.mbo.MboSet.validateTransaction(MboSet.java:7879)
at psdi.txn.MXTransactionImpl.validateTransaction(MXTransactionImpl.java:375)
at psdi.txn.MXTransactionImpl.saveTransaction(MXTransactionImpl.java:207)
at psdi.txn.MXTransactionImpl.save(MXTransactionImpl.java:156)
------------------------------
MAX092012
------------------------------
#AssetandFacilitiesManagement#Maximo