Maximo Open Forum

 View Only
  • 1.  Automated script for People record changes

    Posted 05-29-2021 23:38
    Hi group,

    This is my first post in here so go gentle on me! :)  And I've only been around a Maximo environment for ~7 months.

    We are looking to find out how to create a query that would automatically check for all the possible areas when marking a Person record inactive that can cause errors.  Is this possible to do first of all?

    And if so is there a record of possible errors that we may come cross outside of these that I'm currently aware of?;

    Listed as a Supervisor
    Owner of a Labor Record
    Failed to deactivate this person because he/she is an asset user or custodian
    Failed to deactivate the person because he/she is assigned on a person group

    Thanks in advance for any assistance.
    #EverythingMaximo

    ------------------------------
    Trevor Vornbrock
    2304279 Alberta Ltd
    ------------------------------


  • 2.  RE: Automated script for People record changes

    Posted 05-31-2021 09:46
    To query for a list of areas where you'd encounter an error, no, I don't think that's possible.  Best I know to do is query Maxattributecfg to find where sameastable =person and sameasattribute = personid.

    There are a few areas Maximo checks when attempting to deactivate a person record and it disallows it, like if they are a User/Custodian of an Asset, or a member of a Person Group.  Then there are others that I think it should check because it eventually causes errors, but doesn't check; Supervisor or Lead on a PM record comes to mind (that PM just won't generate any more, and there's not a great way to notice it, unless you just enjoy reading the PMWoGen log file). Then there might be others that won't cause a Maximo problem but might cause a logical business problem, such as Work Order Supervisor or Lead.

    I'm out of office today, but tomorrow I should be able to share with the group a Python script I use when deactivating People records that checks "everything". Haven't had a problem since...

    ------------------------------
    Travis Herron
    Pensacola Christian College
    ------------------------------



  • 3.  RE: Automated script for People record changes

    Posted 05-31-2021 11:55
    Thanks Travis, appreciate the insight.  

    If you're willing to share the script that would be fantastic.

    ------------------------------
    Trevor Vornbrock
    2304279 Alberta Ltd
    ------------------------------



  • 4.  RE: Automated script for People record changes

    Posted 06-01-2021 13:34
    So here it is.  There's probably better/cleaner ways to do this so I'm open to suggestions.  If Maximo already handles it, I let Maximo handle it, mostly to avoid having my script throw an error and Maximo throw an error for the same issue.  Basically all my script is doing is checking to see if the PersonID is a Lead, Supervisor, or Owner of any active records in Job Plans, Preventive Maintenance, and Work Orders.  I also have it automatically remove Personally-Identifiable Information (PII) on the Maximo record, for the sake of compliance with things like GDPR.

    Of course you'll have to tweak this to accommodate any customizations your org has made and for your business processes.  This also assumes you know how to make Relationships and custom Messages in Maximo's Database Configuration application.

    This uses an Attribute Launch Point on the Status attribute.

    from psdi.mbo import MboConstants
    
    if status == 'INACTIVE':
    
        if not jpSupervisor is None:
    
            errorgroup = 'person'
            errorkey = 'PersonIsJobPlanSupervisor'
    
        if not jpLead is None:
    
            errorgroup = 'person'
            errorkey = 'PersonIsJobPlanLead'
    
        if not jpOwner is None:
    
            errorgroup = 'person'
            errorkey = 'PersonIsJobPlanOwner'
    
        if not pmSupervisor is None:
    
            errorgroup = 'person'
            errorkey = 'PersonIsPMSupervisor'
    
        if not pmLead is None:
    
            errorgroup = 'person'
            errorkey = 'PersonIsPMLead'
    
        if not pmOwner is None:
    
            errorgroup = 'person'
            errorkey = 'PersonIsPMOwner'
    
        if not woSupervisor is None:
    
            errorgroup = 'person'
            errorkey = 'PersonIsWOSupervisor'
    
        if not woLead is None:
    
            errorgroup = 'person'
            errorkey = 'PersonIsWOLead'
    
        if not woOwner is None:
    
            errorgroup = 'person'
            errorkey = 'PersonIsWOOwner'
    
        else:
    
            mbo.setValueNull('addressLine1')
            mbo.setValueNull('addressLine2')
            mbo.setValueNull('addressLine3')
            mbo.setValueNull('city')
            mbo.setValueNull('stateProvince')
            mbo.setValueNull('postalCode')
            mbo.setValueNull('country')
            mbo.setValueNull('pccMailbox')
            mbo.setValueNull('location')
            mbo.setValueNull('birthDate')
    
            emailSet = mbo.getMboSet("EMAIL")
            if (emailSet.count() > 0):
                emailSet.deleteAll(MboConstants.NOACCESSCHECK)
    
            phoneSet = mbo.getMboSet("PHONE")
            if (phoneSet.count() > 0):
                phoneSet.deleteAll(MboConstants.NOACCESSCHECK)​

    If you need help understanding the variables and how the corresponding Relationship is created, let me know!

    ------------------------------
    Travis Herron
    Pensacola Christian College
    ------------------------------