Maximo Open Forum

 View Only

 SR workflow

  • Administration
  • Customizations
  • Work Management
Rob Radcliff's profile image
Rob Radcliff posted 09-26-2023 11:32

Hi All,

We have a workflow that fires once and only once when an SR is first saved.

My question is, can the workflow be run anytime the save button is pressed? I'm imagining something like an OnClick event on the Save button that then fires the workflow. Possible?

If you have links to examples, that would be a huge help.

Thanks.

Rob

Prashant Sharma's profile image
Prashant Sharma

Hello- From your explanation looks like first time SR is going in WF so now if the record is workflow, you need to Route WF to next node via Route Workflow button or Select Action.

If you want this to be happening on each save, then you need to add an automation script which fires to Route WF when ever save button is pressed.

Routing WF on Save has biggest issue that if user has to fill 2 data fields for example and then WF should be routed, then if he presses 1 after saving 1st data field then record will route to next node even w/o filling data into 2nd field. That is the reason why different button/select action for Route Workflow is available.

from psdi.mbo import SqlFormat
from psdi.server import MXServer

wfSrv = MXServer.getMXServer().lookup('WORKFLOW')
sqf = SqlFormat(mbo, "ownertable=:1 and wfassignment.ownerid=:2 and assigncode=:3 and assignstatus='ACTIVE'")
sqf.setObject(1, "WFASSIGNMENT", "OWNERTABLE", mbo.getName())
sqf.setLong(2, mbo.getUniqueIDValue())
sqf.setObject(3, "WFASSIGNMENT", "ASSIGNCODE", mbo.getUserInfo().getPersonId())
assignSet = mbo.getMboSet("$CURMBOASGN", "WFASSIGNMENT", sqf.format())
assignSet.reset()
if not assignSet.isEmpty():
assignSet.getMbo(0).completeAssignment(wfAs, "Route WF Complete", True)