Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
  • 1.  Attachment required in application

    Posted Wed August 25, 2021 08:00 AM
    Hello, 

    Any idea how could I make that attachment is required in application where main object is SR --> Service Requests.

    So user must always add picture/attachment then service request could be saved.

    ------------------------------
    Blaz Rakar
    ------------------------------

    #AssetandFacilitiesManagement
    #Maximo


  • 2.  RE: Attachment required in application

    Posted Thu August 26, 2021 10:11 AM
    The classic UI for attachments causes the record to be saved immediately. I think you'd need to use the self-service style (Self Service->Service Requests->Create Service Requests) if you wanted to force an attachment before the SR could be created. You might be able to just use the table option inside of the classic SR application, I'm not honestly sure. But I did confirm that allows you to upload before the record is saved. 

    Normally if you want to require an entry in a child object before a record could be created you'd write an automation script on the launch point of Object Save with the Add option selected for your main object (SR in this case). Because trying to add an attachment using the standard control causes the record to be saved, this would make it impossible for the user to provide the attachment. By switching to the table control you should be able to require it. 

    From there, the script you need (in jython) would be something like below. The message (emx/doclinkRequired) would have to be defined in Database Configuration to render a proper error message to the user. 

    doclinkFound=False
    doclinkSet=mbo.getMboSet("DOCLINKS")
    doclinkMbo=doclinkSet.moveFirst()
    while doclinkMbo:
        if doclinkMbo.getString("OWNERTABLE")=="SR" and doclinkMbo.getDouble("OWNERID")==mbo.getDouble("TICKETUID"):
            doclinkFound=True
            break
        doclinkMbo=doclinkSet.moveNext()
    
    if not doclinkFound:
        service.error("emx","doclinkRequired")​


    ------------------------------
    Steven Shull
    ------------------------------



  • 3.  RE: Attachment required in application

    Posted Fri August 27, 2021 05:19 AM
    Steven thank you very much, everything works :D

    ------------------------------
    Blaz Rakar
    ------------------------------



  • 4.  RE: Attachment required in application

    Posted Mon September 20, 2021 09:06 AM

    Hi Steven,

    Thank you for the useful information, and its' working inside application SR but others applications, example ITEM it's working also but user can't add attachment because the message appear every when click attachment button. Do you have an idea to solve this problem?

    Thank you 



    ------------------------------
    Abdelrahman Elwakeel
    ------------------------------



  • 5.  RE: Attachment required in application

    Posted Mon September 20, 2021 04:11 PM
    As Steven mentioned previously, this is problematic because the options under the attachment button trigger an Object Save event.

    A better approach in general would be to require the attachment prior to a status change. This would let you initially create the record and save it, but it wouldn't become usable until the attachments had been taken care of and the status changed appropriately.

    ------------------------------
    Tim Ferrill
    Solutions Consultant
    Intelligent Technology Solutions
    tferrill@webuildits.com
    www.webuildits.com
    @tferrill/@webuildits
    ------------------------------