Thursday, 22 October 2020

Display Last Workflow Memo in Application field | Maximo

 Requirement

Is it possible to see the last workflow message when I open any record just beside/below the status field? 


Solution: 

Yes, It is possible with 2 different approaches. Let take this example and display the last memo in work order application.

A. Directly with the relationship, no need for a view also. 

B. Create a View to handle a query


A.  Start with easy way, just relationship and display the field

  1. add the following relationship to the workorder
    • Relationship: LAST_MEMO_VIEW
    • Where Clause: ownertable= 'WORKORDER' and ownerid= :workorderid and memo is not null and transid in (select max(transid) from wftransaction where ownerid= :workorderid and memo is not null)
    • Child Object: WFTRANSACTION
  2. Now in the application designer just add a new text field and put LAST_MEMO_VIEW.MEMO in attribute property and make it read-only also. 



--------------------------------------------------------



Let start with option 2.

1. Create a View  based on below SQL  , and name it MEMO_VIEW

CREATE
OR replace VIEW memo_view as
SELECT
    w.ownerid,
    w.OWNERTABLE,
    w.MEMO,
    w.TRANSDATE,
    w.ACTIONPERFORMED,
    wfa.ACTIONID,
    wfa.INSTRUCTION,
    wfa.PROCESSNAME,
    ACTION.value2 AS Status
FROM
    WFTRANSACTION w
    LEFT JOIN wfaction wfa ON wfa.ownernodeid = w.nodeid
    AND wfa.actionid = w.actionid
    AND wfa.PROCESSNAME = w.PROCESSNAME
    AND wfa.PROCESSREV = w.PROCESSREV
    LEFT JOIN "ACTION" ON action.ACTION = wfa.ACTION 1 = 1 --and ownerid = (SELECT TICKETuID FROM TICKET WHERE TICKETID = '495880')
    AND w.memo IS NOT NULL


2. Create a database relation in Workorder Object to Memo_View, let say, we do this for Workorder :

  • Object:                  WORKORDER
  • Relationname:      LAST_MEMO_VIEW
  • Child Object:        MEMO_VIEW
  • Where: 
OWNERID = :workorderid and OWNERTABLE = 'WORKORDER'
AND TRANSDATE = (SELECT max(TRANSDATE) FROM MEMO_VIEW  
WHERE ownerid = :workorderid and OWNERTABLE = 'WORKORDER')


3. Now in the application designer just add a new text field and put LAST_MEMO_VIEW.MEMO in attribute property and make it read-only also. 

 




No comments:

Post a Comment