Search code examples
pythonautomationmaximo

Is there a way to set the parent mbo modified when childMbo was modified in Automation Script (Python)?


Automation Script Object launch point is set to parentMbo. Trigger is upon save, currently happening is when i make changes in childMbo then save() the parentMbo, it will not setValue in 'Description' attribute. I need to change parentMbo first before the changes take effect. Here's my sample code:

triggerInvoke = False

childMbo = mbo.getMboSet("RELATEDTICKET")
if childMbo is not None:
    triggerInvoke = True

if triggerInvoke == True:
    mbo.setValue("DESCRIPTION", "Invoke")

Solution

  • I've had similar requirements on the WO/Tasks hierarchy. Here's an example that should work for you:

    Suppose you have an object launch point on the child object, on the before save event. This code should flag the owner mbo as modified and its save method should be called.

    if mbo.getOwner() is not None and mbo.isModified():
        mbo.getOwner().modify()
    

    You could obtain the same result with an attribute launch point on the child object.

    This is useful if you want to trigger a save process on the parent object depending on children data.