Maximo Open Forum

 View Only
  • 1.  Follow up work order doclinks relationship

    Posted 08-22-2021 18:50
    I'm trying to add to the Workorder Doclinks relationship so that attachments created for the follow up work order will be linked through a relationship but having some trouble getting it to work. This is what I have now:

    select doclinksid from doclinks where (ownertable='INSPFIELDRESULT' and ownerid in
    (select inspfieldresultid from inspfieldresult where resultnum=(select resultnum from
    inspfieldresult where fupobjectid= :fupobjectid and fupobject='WORKORDER'
    and siteid= :siteid and orgid= :orgid and inspformnum= :inspformnum) and orgid= :orgid and siteid= :siteid )) ;

    Any help or guidance is greatly appreciated.
    #MaximoApplicationSuite

    ------------------------------
    Colin Aitchison
    Regional Municipality of York
    ------------------------------


  • 2.  RE: Follow up work order doclinks relationship

    Posted 08-23-2021 09:05
    You shouldn't need to look at the inspection result typically. If the inspection is on a WO and they create a WO using the API action it creates it as a follow up WO meaning it'll have an entry in the relatedrecord table. IBM accounts for this in one direction (IE a follow up should be able to see attachments from the originating WO) but doesn't account for it in the opposite direction which it sounds like you're looking to see (on the original WO see the attachments that get added to the follow up WO(s)). 

    The out of the box syntax that handles the first direction is this:
    UNION ALL select doclinksid from doclinks where (ownertable in ('WOCHANGE','WORELEASE','WOACTIVITY') and ownerid in (select workorderid from workorder,relatedrecord where wonum=recordkey and workorder.woclass = relatedrecord.class and relatedrecclass=:woclass and relatedreckey=:wonum and relatedrecsiteid=:siteid))

    To go in the opposite direction, it should be something like this:
    UNION ALL select doclinksid from doclinks where (ownertable in ('WOCHANGE','WORELEASE','WOACTIVITY') and ownerid in (select workorderid from workorder,relatedrecord where wonum=recordkey and workorder.woclass = relatedrecord.relatedrecclass and relatedrecord.class=:woclass and recordkey=:wonum and relatedrecord.siteid=:siteid))

    I haven't tested it but what I did was essentially flip the attributes being compared on the relatedrecord table so that it should see the records in the opposite direction. I'd test this a bit but I think this is what you're looking for in your relationship.

    I also want to warn you that modifying the DOCLINKS relationship can be broken on patches. The way they manage relationships it's a full replace if they fix a bug in the criteria or add in an additional object. You should document this internally and ensure your team reviews it after a patch to make sure it's still there if it's important to your business processes.

    ------------------------------
    Steven Shull
    IBM
    ------------------------------