Maximo

Maximo

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

 View Only
  • 1.  Autoscript to delete record: Ignore rules?

    Posted Thu June 17, 2021 01:19 AM
    Edited by System Admin Wed March 22, 2023 11:46 AM
    MAM 7.6.1.2; Oracle 19c:

    I want to create a custom button and autoscript that will delete USE WITH classifications records -- even if the classification is used by existing WOs.
    Maximo prevents that when I try to delete the record using the OOB delete button.


    Question:
    Is there a way in automation scripts to ignore Maximo rules like the one described above?

    I'm guessing the knee-jerk reaction might be, "don't do it; too risky; not supported". But my impression is that classification USE WITH records are pretty low risk -- especially for classifications we're not using anymore. If I can't delete them with the UI, then I'll possibly delete them via DB DELETE statements anyway. My preference would be to do it through the UI if I can, though.


    Edit:
    There is a automation script here that can be used to execute an SQL script. I think it could be the answer to my question:

    Automation Script to reset user’s Start Centers (runs an SQL DELETE statement)
    dbShortcut
    Call stored procedure from Automation Script
    How to Retrieve a JDBC connection in Automation Scripts
    #AssetandFacilitiesManagement
    #Maximo


  • 2.  RE: Autoscript to delete record: Ignore rules?

    Posted Thu June 17, 2021 01:23 AM
    Edited by System Admin Wed March 22, 2023 11:50 AM

    For what it's worth, I'm just trying to explore my theoretical options in a non-Prod environment. I want to learn what can be done in POCs. Not what should be done. That's a different story. For this particular scenario, I may very well go with a different option -- a custom classification ACTIVE? field and security group. But right now, I'm curious about deleting low-risk records via autoscripts, instead of directly in the DB.

    Thanks.


    #Maximo
    #AssetandFacilitiesManagement


  • 3.  RE: Autoscript to delete record: Ignore rules?

    Posted Thu June 17, 2021 08:39 AM
    Well, I'm more script user then writer. But as far as I know, for some functions there is possibility to ignore such business rules.

    ------------------------------
    Peter Domankuš
    ------------------------------



  • 4.  RE: Autoscript to delete record: Ignore rules?

    Posted Thu June 17, 2021 09:14 AM
    Maximo is blocking this because the action is deliberately corrupting the database.
    The automation script should not be able to delete the entries - and it sounds like you are seeing an error preventing it.

    You may not encounter problems now but you are likely to experience problems in the following situations:
    • Opening/manipulating the record which references the deleted data
    • Duplicating the record e.g. for a new one to use
    • Upgrading the database
    • BIRT reports that uses the value as a lookup


    ------------------------------
    Mark Robbins
    Support Lead/Technical Design Authority / IBM Champion 2017 & 2018 & 2019 & 2020 & 2021
    Vetasi Limited
    https://www.linkedin.com/pulse/maximo-support-advice-from-non-ibm-engineer-article-mark-robbins/
    ------------------------------



  • 5.  RE: Autoscript to delete record: Ignore rules?

    Posted Thu June 17, 2021 10:14 AM
    Sure. I do not recommend deleting tickets, workorders, classifications and many more such records 'cause there are various relations between those records and other records.
    But I still consider Use With relation for classification a low to no risk. Prove me wrong if you don't agree.

    ------------------------------
    Peter Domankuš
    ------------------------------



  • 6.  RE: Autoscript to delete record: Ignore rules?

    Posted Fri June 18, 2021 08:37 AM
    Not extremely important to the conversation but I'm not sure how you suppress the canDelete method with code which is where this error is thrown. You could delete it via other ways (such as SQL) but then you need to make sure you purge all the other objects too (such as CLASSSPECUSEWITH). Also, as Mark mentioned, integrity is the most critical thing when it comes to developing inside of Maximo. I couldn't count the amount of issues I've seen where someone did something they knew wasn't supported (thinking what's the harm?) and broke processes in strange ways. 

    CLASSUSEWITH is used for determining if a classification is used to determine if it can be deleted. By deleting the CLASSUSEWITH reference, you'll be allowed to delete the classification even if it was used on records. As an example, in a demo environment there is a classification ROLLER (BEARING\ROLLER) that is associated to 3 items. Try to delete it and it will fail. Remove the classusewith entry and now you can delete the entire classification even though it was referenced on records. So now you have to figure out what might break on a record that has an orphaned classstructure record.

    ------------------------------
    Steven Shull
    Director of Development
    Projetech Inc
    Cincinnati OH
    ------------------------------