Maximo

Maximo

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

 View Only
  • 1.  Create Workorder From SRs Using Escalation

    Posted Sat June 21, 2025 07:46 PM

    Hello Everyone, now i am trying to create workorder for each SR with status NEW but i want to make this process through Automation Script because i want to copy some specific fields from the sr to the created workorder.

    I have tried the following:

    1. first method: i have created the escalation with condition status = 'NEW'
    2. Empty condition Escalation Point
    3. action group which have:
      1. Applicaiton Action Create WO
      2. Script that copy my desired fields, change current sr status to inprogress and apply sla on the workorder

    the escalation is running and only the first action is seems done but the script is not running or running without making what i am waiting for.

    i have attached the script.

    the used relation in the script is from SR to Workorder ==> status = 'NEW' 
    AND origrecordclass = 'SR' 
    AND origrecordid = :ticketid 
    AND createdate = (
        SELECT MAX(createdate) 
        FROM workorder 
        WHERE origrecordclass = 'SR' 
          AND origrecordid = :ticketid 
          AND status = 'NEW'
    )
    -----------------------------------------------------------------------------------------------
    Also i have tried to create the workorder from scratch using an script without using the application action and then copy the desired attributes and then appling the SLA on the created workorder by invoking workflow from the script that has apply SLA application action.
    I have attached the script .
    ----------------------------------------------------------------------------------------------
    Both ways are not working i need to know why.



    ------------------------------
    Abdullah Blal
    Software Engineer
    Megasoft
    Giza
    +201155119254
    ------------------------------

    Attachment(s)



  • 2.  RE: Create Workorder From SRs Using Escalation

    Posted Mon June 23, 2025 09:12 AM

    Questions:

    1. When should a Work Order (WO) be created from a Service Request (SR) in NEW status?
    If, after thorough analysis, you determine that creating an Escalation is the best approach, please consider the following:

    Steps to Implement Escalation Logic:

    1. Define the Escalation Criteria:

    • Create an Escalation with a well-defined where clause.
    • I noticed you've added internal priority to the script. If this is a field on the SR you are referring to then, include it in the Escalation where clause criteria.
    • Ensure the Escalation targets only the correct SRs for which a WO should be created. So, you can try to add all possible SR conditions that should be met.
    • To avoid creating duplicate WOs for the same SR, include a nested condition in the where clause to check that a WO does not already exist. Instead of relying solely on createdate, consider using a combination of SR status (NEW) and WO reported date for better accuracy. Because I saw you used MAX(). 

    2. Use Out-of-the-Box (OOB) Features Where Possible:

    • If available in your environment, leverage the OOB crossover domain TICKET2WO to transfer values from SR to WO.
    • This approach minimizes the need for custom scripting to copy values, keeping your script cleaner and easier to maintain for future attributes added on SR.

    3. Simplify Script Logic:

    • Avoid using MXServer in your script. The Escalation provides a reference to the SR MBO.
    • Use the relationship and the OOB createWorkorder() method to generate the WO directly from the SR.

    Hope this helps! Let me know if you'd like help drafting the actual where clause or reviewing your current script.



    ------------------------------
    SANJAY PATIL
    ------------------------------



  • 3.  RE: Create Workorder From SRs Using Escalation

    Posted Mon June 23, 2025 10:55 AM

    thanks for your reply, so can you tell me the right arrangement of the action group to achieve the following :

    1. Set the owner to the current ticket
    2. Change status to inprog
    3. Create a work order 
    4. Copy values of the workorder ==> as in your reply, I will consider all my fields in the crossover domain, which is logically true.✅
    5. apply sla on the newly created work order


    ------------------------------
    Abdullah Blal
    Software Engineer
    Megasoft
    Giza
    +201155119254
    ------------------------------



  • 4.  RE: Create Workorder From SRs Using Escalation

    Posted Thu June 26, 2025 06:43 AM

    Hi Abdullah, 

    Set the owner, it will automatically change SR status to QUEUED.

    Create the Work Order(s), there are several options.

    The TICKET2WO crossover domain will fire automatically, there is nothing to do, but you may need to place conditions as to when data is copied.

    There are automatic updates of status from WO back to SR so status will go to INPROG based on first WO going to INPRG. If needed create additional SR status at QUEUED level to indicate when WO created. 

    Apply WO SLA via Workflow or Escalation on WO object, not via SR script.

    Try to avoid Scripting use OOB functionality, and script only if client cannot adopt OOB. It is very common for customisation to be removed, several years after it was developed, when clients realise it is better in the long run not to carry the burden of excessive scripts.

    Regards Andrew



    ------------------------------
    Andrew Jeffery
    Maximo SME
    ZNAPZ b.v
    Barnstaple
    +44 (0)777 1847873
    ------------------------------



  • 5.  RE: Create Workorder From SRs Using Escalation

    Posted 30 days ago

    Hi Andrew,

    I hope you are well. 

    the point here is that my work orders will be created upon the following:

    • PM will generate the work orders automatically
    • the desired attributes that I want it to be crossed, it presented on the job tasks table, and I want to cross them to the wo activity table of the created work orders
    • I have tried some crossover domains but with no luck in achieving what I want.



    ------------------------------
    Abdullah Blal
    Software Engineer
    Megasoft
    Giza
    +201155119254
    ------------------------------



  • 6.  RE: Create Workorder From SRs Using Escalation

    Posted 30 days ago

    Sorry Abdullah but I don't understand. The original question was about generating a work order from a service request. You latest response refers to a PM, there is no connection between a PM and a service request in Maximo.

    What application are you in and what action is being used?

    If you are in Work Order Tracking on a PM work order and you are creating a follow-up Service Request then are you trying to copy the tasks of the work order to become activities of the ticket (Service Request)? That is not possible in Maximo.

    Can you clarify your need starting with the application and action you are performing.



    ------------------------------
    Andrew Jeffery
    Maximo SME
    ZNAPZ b.v (a Naviam company)
    Barnstaple
    +44 (0)777 1847873
    ------------------------------



  • 7.  RE: Create Workorder From SRs Using Escalation

    Posted 30 days ago

    Yeah, yeah, you are correct, I am a little bit confused. So I have 2 questions right now:

    1. Create Workorder From SRs Using Escalation ==> and you have answered on, but I have a concern, which is I need all of the actions that I have represented above to be done automatically once the escalation is running.
      1. Set the owner to the current ticket
      2. Change status to inprog
      3. Create a work order 
      4. Copy values of the workorder ==> as in your reply, I will consider all my fields in the crossover domain, which is logically true.✅
      5. apply sla on the newly created work order. (All of these actions need to be taken by the escalation action group.)

    2.    The other question, which we can discuss in another thread, is: 
      1. In the pm application, once work orders are created 
      2. I need to copy specific values from the job tasks of the PM job plan to the wo activity table on the newly created work orders.(Crossover Domain doesn't work.
      3. I need your opinion on that question too ==> Crossing Specific Values From Job Tasks On PM to the Created Workorders.
      4. You can access the thread through the above link.

    Appreciate your consultation in both threads, Andrew.



    ------------------------------
    Abdullah Blal
    Software Engineer
    Megasoft
    Giza
    +201155119254
    ------------------------------



  • 8.  RE: Create Workorder From SRs Using Escalation

    Posted 30 days ago
    Edited by Kalpana Devaraj 30 days ago

    Please try with below information and it should be working as expected.

    Create Object Launch Point script on SR object.

    Object: SR

    Events: Save

    Save: Select Add only & Select Before Save

    Launch Point Condition: :status = 'NEW'

    Script:

    from psdi.server import MXServer
    from psdi.mbo import SqlFormat, MboConstants

    if not interactive:
        # Fetch Action MBO for "SR CREATEWO"
        actionSet = MXServer.getMXServer().getMboSet("ACTION", mbo.getUserInfo())
        try:
            sqf = SqlFormat("ACTION = :1")
            sqf.setObject(1, "ACTION", "ACTION", "SR CREATEWO")
            actionSet.setWhere(sqf.format())
            actionSet.reset()

            if not actionSet.isEmpty():
                # Set owner before save (required for integration-originated records)
                mbo.setValue("OWNER", "MAXADMIN", MboConstants.NOACCESSCHECK)
                mbo.getThisMboSet().save()

                # Execute the action
                actionSet.getMbo(0).executeAction(mbo)

                # Get the Related WO created from the action
                woset = mbo.getMboSet("RELATEDWO.RELATEDRECWO")
                wosetmbo = woset.getMbo(0)

                # Copy FAILURECODE from SR to PROBLEMCODE of the WO
                if wosetmbo is not None:
                    assetcode = mbo.getString("FAILURECODE")
                    wosetmbo.setValue("PROBLEMCODE", assetcode, MboConstants.NOACCESSCHECK | MboConstants.NOVALIDATION)
                    woset.save()
        finally:
            actionSet.close()
            actionSet.clear()



    ------------------------------
    Kalpana Devaraj
    ------------------------------