One of the missing features we found is to NOT REINSTATE the work order generated from the PM.
Behavior:
1. Cancel from the Status Change Button:
If the user cancels a work order from the Change Status button, a Dialog box appears something like "do you want to reinstate " with Yes and No buttons.
(you have the option to choose either Reinstate or Not)
2. Cancel from the Workflow Action
If the Assigned User of workflow wants to CANCEL the record. The system will cancel the workflow and with Reinstate option Yes.
(No prompt/dialogs appear to ask for reinstating Yes or No. )
Therefore below is the solution in Jython:
Create an Action launch point and call after the Status Change Action in workflow line:
from java.util import Calendar
status = mbo.getString("STATUS")
if status =='CAN':
pmset = mbo.getMboSet("PM").getMbo(0)
if pmset is not None:
pmcounter = pmset.getInt("PMCOUNTER")
pmnextdate = pmset.getDate("NEXTDATE")
pmfrequency = pmset.getInt("FREQUENCY")
pmfreunit= pmset.getString("FREQUNIT")
cal=Calendar.getInstance()
cal.setTime(pmnextdate )
if pmfreunit == 'YEARS':
cal.add(cal.YEAR,pmfrequency)
if pmfreunit == 'MONTHS':
cal.add(cal.MONTH,pmfrequency)
if pmfreunit == 'DAYS':
cal.add(cal.DATE,pmfrequency)
if pmfreunit == 'WEEKS':
cal.add(cal.WEEK,pmfrequency)
vDate=cal.getTime()
pmset.setValue("PMCOUNTER" ,pmcounter + 1, 11L )
pmset.setValue("NEXTDATE",vDate,11L)
pmset.save()
No comments:
Post a Comment