≡ Menu

How NX Attribute Mapping Overrides Teamcenter Post-actions

Share the knowledge

I used to think that any code I put into a post action registered against item or revision creation would be the last thing to run after the creating the item or revision. But that is not true when NX is involved.

I discovered this by implementing a post-action on Item creation that set the object_name field after consulting an external system. Everything appeared fine when I tested it in the Teamcenter rich client. However I discovered that when I created an item in NX the name that my code had applied had been lost. Stepping through the code with the debugger verified that it was still behaving properly but apparently the value was changing after my post-action had exited. So, what had happened?

Attribute Mapping

When attributes are mapped between Teamcenter and NX the mapping specifies whether Teamcenter, NX, or both systems are the master of the attribute. In other words, which system can you use to edit the local attribute and have the change show up in the other system? Item.object_name in TC is hard-coded to be mapped to the NX property DB_PART_NAME and the master is both.

The Post Post-Action Action

It seems that NX’s local values for properties are mapped to Teamcenter after the item is created and the post-action is run. So whatever values NX has locally for the DB_PART_NAME (the item ID, by default) is applied to the Teamcenter item after the post-action is run.

I’ve also seen this same behavior with other mapped attributes where I have defined the mapping and not just the hard-wired default ones.

I checked with GTAC and apparently there isn’t any way to stop this except to create a custom user exit for NX that sets the property correctly. I guess this would be something that would run after the mapping that happens after the post-action.

  • Shrikant

    I have faced a similar problem while upgrading from TC2007.2 to TC8.3.3.1, while doing a save as from NX found out that deep copy rule gets executed after the post action defined on save as. In the save as post action we were clearing some attributes on the IRM of the newly created Item Revision but found out since, the deep copy rule was not executed IRM did not exist. We had to write a post action for the deep copy and move this block of code there.

    Regards,
    Shrikant

    • http://plmdojo.com/ Scott Pigman

      Really? the Item rev master was not created? The only way I ever accomplished that was by messing with the create descriptor, but then I broke OOTB functionality that counted on the IRM being there.

      • Teamcenter Heretic

        I have seen this since the early iMan days.
        In fact, much of my ITK code checks for this exact scenario.
        Never really found out what causes it though. I think perhaps a disturbance in The Force….

      • Shrikant

        I did a shoddy job of explaining the issue :)

        There are couple of issues in TC 8.3 – atleast from what i could understand.

        The sequence in which deep copy rules are executed is not
        the same when the save as is done from NX compared to when it is done from
        Teamcenter.

        When the save as is done from NX, deep copy rules are
        applied after the save as post action is executed. So, as you mentioned, the post action is not the last thing to run after item or item revision creation when it comes to NX:In TC 2007 we were
        explicitly calling the ITEM_perform_deepcopy in the save as post action and clearing
        some attributes from the IRM but in TC8.3 we cannot do this because then deep
        copy rules would be applied twice, which would violate some cardinality
        conditions.
        Hence, we had to move the code from the save as
        post action to the deep copy post action. Which in our case is acting as the
        Post Post-Action Action now :)
        Also, there
        have been changes to the way deep copy rules are applied in TC8.3. I am
        paraphrasing here from the documentation :

        Prior to TC8, some of the deep copy rules applied during the
        saveas and revise were hard coded – I assume that includes copying the Item
        Revision master form. But in TC 8.3 they have been exposed in the foundation
        template as deep copy rules.

Optimization WordPress Plugins & Solutions by W3 EDGE