Maximo Open Forum

 View Only
  • 1.  Copy Doclinks

    Posted 4 hours ago
    Edited by Jason Johnson 4 hours ago

    We have a custom application that we can attach doclinks to. We would like to copy all the attachments when we duplicate the record. It doesn't do that "out of the box" so we tried an automation script using the "afterduplicate" automation script. However, we are getting multiples when ran.

    from psdi.mbo import MboConstants
    
    orig_doclinks_set = mbo.getMboSet("DOCLINKS")
    
    dup_doclinks_set = dupmbo.getMboSet("DOCLINKS")
    
    orig_doclink = orig_doclinks_set.moveFirst()
    while orig_doclink:
        new_doclink = dup_doclinks_set.add()
        
        new_doclink.setValue("DOCTYPE", orig_doclink.getString("DOCTYPE"), MboConstants.NOACCESSCHECK)
        new_doclink.setValue("DESCRIPTION", orig_doclink.getString("DESCRIPTION"), MboConstants.NOACCESSCHECK)
        new_doclink.setValue("URLTYPE", orig_doclink.getString("URLTYPE"), MboConstants.NOACCESSCHECK)
        new_doclink.setValue("URLNAME", orig_doclink.getString("URLNAME"), MboConstants.NOACCESSCHECK)
        new_doclink.setValue("ADDINFO", orig_doclink.getBoolean("ADDINFO"), MboConstants.NOACCESSCHECK)
    
        orig_doclink = orig_doclinks_set.moveNext()

    Here is the result. There should only be the second entry, not sure why we are getting the first, there is only a single attachment in the original record.

    Does anything look incorrect with the script? Or maybe a setting that does the copy when duplicated that I missed?

    Edit:

    Even stranger, deleting the first attachment, deletes them both.


    #Administration
    #Customizations

    ------------------------------
    Jason Johnson
    RSI
    ------------------------------