Maximo Open Forum

 View Only
  • 1.  Put a default value in the service request classification

    Posted 03-06-2024 08:24
    Edited by Christopher Winston 03-08-2024 19:35
    Hi All,
    My objective is to put a default value in the service request classification box When selecting location like 'XX%'
    I tested with the script below, Unfortunately it didn't work
    Thanks for your help
    from psdi.mbo import MboConstants
     
    def retrieve_and_set_classification(mbo):
        location = mbo.getString("LOCATION")
        
        # Check if the location starts with 'XX%'
        if location.startswith("XX%"):
            # Retrieve classification based on CLASSSTRUCTURE.CLASSIFICATIONID
            class_structure_set = mbo.getMboSet("CLASSSTRUCTURE")
            class_structure = class_structure_set.getMbo(0)
            
            if class_structure is not None:
                # Check if the classification name is 'XXX_SR'
                classification_name = class_structure.getString("CLASSIFICATIONID")
                if classification_name == "XXX_SR":
                    # Set classification in SR.CLASSIFICATION
                    mbo.setValue("CLASSIFICATIONID", classification_name, MboConstants.NOACCESSCHECK)
     
    # Trigger the script when a Service Request (SR) record is accessed
    if mbo.getUniqueIDName() == "TICKETID":
        retrieve_and_set_classification(mbo)






  • 2.  RE: Put a default value in the service request classification

    Posted 03-24-2024 11:43

    Hi @walid malki! I have an automation script that resolve something similar. The part that analyze the condition is: 

    if ars_clasificacion.find("GTI",0,3) > -1:

    You can probe with this instead of if location.startswith("XX%"):

    In your case should be: if location.find ("XX",0,2) > -1:

    Because It is possible that the problem may arise from the condition. Maybe you'll figure it out.

    Regards!



    ------------------------------
    Martin Fabra
    ARSAT S.A.
    ------------------------------