Maximo Open Forum

 View Only
  • 1.  Automation script - Please Help

    Posted 07-25-2024 22:54

    Appreciate any input from you guys:

    I created a new persistent date attribute in ticket object named srdate and i want to populate that field with YEAR only for every transaction in our service request application.

    Can anyone guide me on how to do it?

    Thanks and keep safe everyone.


    #Administration

    ------------------------------
    Darwin Bagangan
    GNPOWER
    ------------------------------


  • 2.  RE: Automation script - Please Help

    Posted 07-26-2024 09:07

    Hi @Darwin Bagangan!

    Do you want it to save the year when SR is created, or when SR is modified?

    Regards!



    ------------------------------
    Martin Fabra
    ARSAT S.A. - Actively seeking employment
    ------------------------------



  • 3.  RE: Automation script - Please Help

    Posted 07-28-2024 20:26

    hi @Martin Fabra, thanks for the current year solution. appreciate if you ca nshare also the script for "OTHERYEAR".

    Have a good day ahead.

    Thanks in advance.



    ------------------------------
    Darwin Bagangan
    GNPOWER
    ------------------------------



  • 4.  RE: Automation script - Please Help

    Posted 07-26-2024 09:57

    Darwin, 

    If you want to save the current year only when you create a new SR, this jython script on SR OBJECT solves it:

    # Script: set_current_year_on_create.py
    # Descripción: Save current year on field "CURR_YEAR" when you create a new SR

    from psdi.server import MXServer
    from java.util import Calendar

    # Get current year
    current_year = Calendar.getInstance().get(Calendar.YEAR)

    # Set the value of the persistent field
    mbo.setValue("CURR_YEAR", current_year)

    Then I will try to pass you the other one, when the SR object is modified.

    Regards!



    ------------------------------
    Martin Fabra
    ARSAT S.A. - Actively seeking employment
    ------------------------------



  • 5.  RE: Automation script - Please Help

    Posted 07-28-2024 20:24

    HI Martin,

    Thanks thanks thanks. This really works for me.

    What Im trying to achieve is to put this script-field on dashboard and use it in result set like in picture below. 



    ------------------------------
    Darwin Bagangan
    GNPOWER
    ------------------------------



  • 6.  RE: Automation script - Please Help

    Posted 07-29-2024 08:16

    Hi Darwin!

    I'm glad if it worked for you. If you need anything else, let me know and I will be happy to help you.

    Regards!



    ------------------------------
    Martin Fabra
    ARSAT S.A. - Actively seeking employment
    ------------------------------