Maximo

Maximo

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

 View Only
Expand all | Collapse all

Best way to determinate is MIF import or not

  • 1.  Best way to determinate is MIF import or not

    Posted Thu November 16, 2023 10:11 AM
    Edited by Andrey Ilinskiy Thu November 16, 2023 10:12 AM

    Hi!

    I have auto script on attribute init. 

    I need to validate if it is imported via MIF (also as an import in the application) or an attribute initialized in the interface. 

    Unfortunately, I found that when importing an object via MIF, even if the attribute is not in the object structure it always initValue, so my script also acts. 

    "Interactive" does not pass, because when it is imported via application it is also True. 

    Found only that way: 

    IntegrationContext.getCurrentContext().getProperty("action") not in ("Add", "Change", "Sync")*
    *of course with NullPointers validations
    but in some cases it takes up to 30ms. On botch import of 5000 records it is 2,5 minutes.
    So, maybe any other ideas ?



    ------------------------------
    Andrey Ilinskiy
    ------------------------------



  • 2.  RE: Best way to determinate is MIF import or not

    Posted Fri November 17, 2023 03:52 AM

    Hi Andrey,

    it should be enough to check if IntegrationContext.getCurrentContext() is None. It should be a bit quicker, but it's hard to tell by how much.



    ------------------------------
    Witold Wierzchowski
    ------------------------------