2

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")
James
  • 55
  • 1
  • 9
  • 2
    Style comment: `getMboSet()` returns an `MboSet`, so you should either call it `childSet` and then treat it appropriately or add `.getMbo(0)` after the call to `getMboSet()`. Given that the `RELATEDTICKET` relationship is likely to always return an MboSet, even if it has zero Mbos in it, the latter approach is likely what you want. – Preacher Nov 15 '19 at 04:27

1 Answers1

3

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.

JPTremblay
  • 900
  • 5
  • 8