6 Replies Latest reply on Feb 17, 2014 11:31 PM by George Lester

    EPDM API - Perform action after saving a data card.

    George Lester

      I'm writing an add-in which will rename a file after its file data card is saved. This seems simple enough, but I am running into a few issues.

       

      To do this I have added a hook for EdmCmdType.EdmCmd_CardButton. Then in my OnCmd method I am checking EdmCmd::mbsComment for "OK". This fires when the save button is pressed.

       

      The problem is that this will still fire if the card has validation errors, i.e. the data card changes aren't actually saved to the database. In this circumstance, I need to avoid renaming the file. Ideally, I would use a different hook but I can't see one that's appropriate in the documentation.

       

      To get around this, I am trying to manually validate each control on the data card to see if the save will fail. I am able to get the controls via the IEdmCard6 interface and the validation rules from IEdmCardControl5::GetValidation(). I believe the value for each control may be accessed by IEdmEnumeratorVariable8::GetVar().

       

      My questions:

      • How do I determine the variableName required for IEdmEnumeratorVariable8::GetVar() so that I can get the value for the IEdmCardControl5 object?
      • Other than validation errors, are there other things that will stop a data card from saving?
      • Is there a different EdmCmdType that I should be using to do this? i.e. one that fires after the save is successful.
      • Am I going about this the wrong way? Should I just use database triggers, or some other method instead?

       

      Many Thanks,

      George