Solved

Document Create from Template, Macro not executed

  • 15 October 2022
  • 3 replies
  • 193 views

Userlevel 1
Badge +7

We want to execute a document macro after creating from template. Follwoing procedure is supposed:

  • the document is created with class and format
  • file is copied from template
  • file is checked out
  • macro CREATENEW should be executed!

The macro is not executed. Instead the file is only opened. (document process action is set for the class, document class has macros set, CHECKIN and CHECKOUT work normal)

The Debug log shows the following lines:

CreateDocFromTemplSet(Objkey='6FB1409321FB4B0AB9881F4B51C5E937')

GetDefaultValuesForNewDocument(LuName='EngPartRevision',KeyRef='PART_NO%3D0398028%5EPART_REV%3DR01%5E',DocClass='2057',LanguageCode='de',Format='A4',DocRev='A1',DocSheet='1',OnClassChange='NO')

CreateDocument

GetLocalFileName(DocClass='2057',DocNo='1000543',DocSheet='1',DocRev='A1')

GetMacroInfo(DocClass=null,DocNo='1000543',DocSheet=null,DocRev=null,Process='CREATENEW')

GetAttachmentCount(Lu

 

With that Parameters for GetMacroInfo there is no macro found.

The question is now, why are the paramters DocClass, DocSheet and DocRev in the context have the value ‘null’.

Has anyone some hints for that?

 

Additional I have the question: Is it possible to disable the automatic document open function when creating a document from template?

 

icon

Best answer by Mathias Dahl 18 October 2022, 16:37

View original

3 replies

Userlevel 7
Badge +30

Hi,

We discovered this problem recently as well and are working on a solution.

There is a workaround: instead of using the command New Document From Template, use the command New Document. Select the class and enter the title. Then, on the card that shows the new document, click the Edit command/button. This should download a copy of the document file template as well as run a CREATENEW macro, if available.

Perhaps you can try this and report back your findings?

Thanks!
 

Userlevel 1
Badge +7

Thanks very much for your hints.

Your workaround works good. The Macro is started as needed.

Userlevel 7
Badge +30

Thanks for reporting back, now we know it does not only work for me 🙃

Reply