The filename already changes when the document name is changed but I need the document name to change when the document name is changed.
I assume I'll need to create a custom module with a post trigger on the Doc code written in C++ and register the module. Then add the dll to everyone's PWE.
Looking for guidance here as I normally write external programs in VB.NET.
It isn't clear to me what exactly you are trying to do. What do you mean by "..I need the document name to change when the document name is changed."?
As I like to say, "words get in the way". I think you mean HOOK when you say "trigger". And yes, you set hooks by the use of a custom module.
I suspect that you are asking about a way to keep the document's name and the document's filename in sync when the document's "Document Code" is changed.
I would suggest that you take a look at my "HookWatcher" tool and walk through the steps you want to automate to see what hooks are available for each part of the process. I suspect that if you are updating the document's "Document Code', that it will "fire" AAHOOK_UPDATE_LINK_DATA, and with a post hook (success), you could then examine the document's name and file name to see if they match the "PlaceHolder" part of the Document Code and then change the document's name and filename to match.
But I'm just guessing on what you want to do.
And along with more details on what you are trying to accomplish, it is always helpful to specify what version of ProjectWise you are using, including the version of the PW SDK.
You are correct, I want the Document Code post hook success to sync the Document Name and Filename.PWE 10.00.03.280, PW SDK 2018
See if setting a post hook on AAHOOK_CODE_GENERATION_DLG is what you need. I suspect that this hook only "fires" if you are using the Document Code Dialog.
If you are setting the Document Code via API functions,then I suspect that AAHOOK_UPDATE_LINK_DATA may be the approach that may work for your needs.
You may want to review the HookImpl sample code included with the ProjectWise SDK as it sets up a pre, action and post hook which you can use as a "starting" point for your efforts.
Eager to understand what your use cases might be.
If the intended use is to align document name/filename on a change to document code, how will that change be reflected on versions other than the active version? Metadata in earlier versions (including the document code) are read only.
Document Name and Filename needs to match Document Code. Currently users are changing Document Name only and causing issues.
Not concerned about previous versions, they can stay as is.