AnsweredAssumed Answered

Using a hook across multiple classes

Question asked by Tara Campese on Sep 15, 2017
Latest reply on Sep 22, 2017 by Amen Allah Jlili

I'm not sure if what I want is possible. If it is not possible, I will just create two separate add-ins.

 

Here's what I want my program to do:

When a user adds a new document to the vault with this add-in, the add-in assigns necessary data card info, checks in the new document, checks out a "Table of Contents" document, populates the ToC Doc, then checks in the ToC Doc.

 

Everything works great when there are breakpoints. The issue I'm having is that the check-in command does not wait for the document to get added to the vault and thus fails when there are no breakpoints and I am not sure how to do this without an add hook. Is there a way to access the add hook from outside of OnCmd? Or a way to call OnCmd from another class? Or is there an easier way to do this?

 

I tried Class1.OnCmd(EdmCmdType.EdmCmd_PostAdd, dFile) where dFile is defined as the new file (iedmfile5). But I keep getting the error that EdmCmdType.EdmCmd_PostAdd is an enumerator and not a EdmCmdType. However, this help file is what I get when I search for EdmCmdType. I really don't know what to put as the OnCmd variables to pass.

 

If I break this project into 2 add-ins (one that creates the new file and one that fills out the ToC Doc), it creates a lot of duplicate work getting the variables all over again. It's not a big deal; I am just wondering if there is a more elegant solution.

 

For reference, I am using PDM Professional 2017 SP3 and VB.Net.

 

Thanks,

Tara

Outcomes