Thursday 3 May 2018

Deny Users From Editing Application Record if It's Not In Their Workflow Assignment Using Automation Script | IBM Maximo

One of the requirements we get that in a active workflow process, if a record is not in certain user's assignment, then it cannot be edited. Only assigned user can edit that record. We have implemented this requirement using automation script on Purchase Requisitions Application.

Object Launch Point :  PR

Script : Jython

Object Event Condition: 
(select count (ownerid) from wfassignment where ownertable='PR' and assignstatus='ACTIVE'
AND ownerid in (select prid from pr  where prnum=:prnum))>0
and
(select count(ownerid) from wfassignment where ownertable='PR' and assignstatus='ACTIVE'
and assigncode in (:&USERNAME&) and ownerid in (select prid from pr  where prnum=:prnum))=0

Events: Save, Add, Update, Before Save


Create Error Message:

Create error message in database configuration, errorgroup = 'PR' and errorkey = 'PR-ASSIGN'

Source Code:

errorgroup = 'PR'

errorkey = 'PR-ASSIGN'





2 comments:

  1. Dear Umar,
    Maybe you can share how to trigger workflow (Route an assignment) from JSON API ?

    ReplyDelete
  2. You can trigger a workflow using the below script. Create a launch point with the name of the workflow you want to trigger. You can set this is to trigger on the Save > On Add launch type.

    from psdi.server import MXServer

    MXServer.getMXServer().lookup("WORKFLOW").initiateWorkflow(launchPoint,mbo);

    ReplyDelete