Showing results for 
Search instead for 
Do you mean 

Run external command with workflow help



I have a batch file which runs another files. Before running this command I have to get information from TC information about ItemID and revID.

In TC8.1 we runned workflow with EPM-invoke-system-action which runned batch file (BOM2PDF1.bat attach.) which got the desired information and then runned the right batch file.

In TC10.1 this does not work anymore.

So I tried different approach I created LOV with values:





And created workflow with EPM-run-external-command which connects to lov.

This command runs this batch BOM2PDF.bat

echo off
set ITEM=ARG~-item
set REV=ARG~-rev


call \\server\tceng_reports\scripts\DS\BOM2PDF\BOM2PDF.exe %ITEM% %REV%
call \\server\tceng_reports\scripts\DS\BOM2PDF\upload.bat


But it does not work. I know I have to change something but I just do not know what.

Also TC does not report any error.


Any help would be appreciated.







Re: Run external command with workflow help

Mybee you could try with EPM-run-external-command and see if that works.


I use EPM-run-external-command ... and I have some problems ...

What I want to achive is to get a step conversion of some Catia parts.

Created a workflow and added the handler EPM-run-external-command.

When the workflow is launced it's exporting the files to specified folder and it also creates two text files with information like item id, user id etc.

But the workflow get frozen and the script isn't launched. I can't tell why as it seems to be to workflow that waits for the script to run. I need to kill my TC client hard.


When I run the script manually it will convert the exported Catia part file into a stepfile.

anyone who can advice .. and I do think I will try to use EPM-invoke-system-action


Second someone how can say plus and minus with EPM-run-external-command and EPM-invoke-system-action.

What I see is that on EPM-invoke-system-action it states it can run perl script so can't EPM-run-external-command run perl or VB scripts?

In my case I use a VB script as I wanted to use UNC path so all users use same location.




Re: Run external command with workflow help

I use the EPM-run-external-command WF handler for running external commands to convert and rename files in Tc10.  It works for me in Tc10 as it has done in past versions going back to Tc2007.  I've attached a link to a presentation I did on this topic.  It's dated, but the concept is still in use today in Tc10.  Maybe there is something useful to you in it.


Creating PDF Files Using OOTB Tools


Larry Carpenter, P.E.
CAxPLM Architect @ Siemens Molecular Imaging
Past Board Member @ PLM World, Inc,

Re: Run external command with workflow help


I solved this last year with run-external  command when I found your pdf file Larry. We found out that invoke-system -action is not working in TC10.1 as it suppose to, so I opened IR on GTAC. But your pdf helped me to resolve also some other issues. So this issue is solved.




Re: Run external command with workflow help

Hi Larry


It's yours I used as base. I run 4 tier client and have pointed the start script to a UNC path and it's a vbs script.

The Workflow is a simple Start-End with the handler between.

I get no logs on what is causing the hang in the workflow.


My LOV looks like this

    <TcLOV name="S2TC_Catia2StpLOV" lovType="ListOfValuesString" usage="Exhaustive"
        description="Calls an external command to convert Catia part into stepfiles"
      <TcLOVValue value="INPUT~Target=$TARGET.(ItemRevision)" description="" conditionName="isTrue"/>
      <TcLOVValue value="INPUT~Application=\\vtl00-ms036\Catia2Stp\StartConversion.vbs" description=""
      <TcLOVValue value="INPUT~CallPerTarget=YES" description="" conditionName="isTrue"/>
      <TcLOVValue value="INPUT~ExportPath=\\vtl00-ms036\Catia2Stp\In" description=""
      <TcLOVValue value="INPUT~DataPath=\\vtl00-ms036\Catia2Stp\In" description=""
      <TcLOVValue value="INPUT-ExportOrigFile=No" description="" conditionName="isTrue"/>
      <TcLOVValue value="INPUT~ErrorMsg1=Conversion of stepfile failed %$SYSTEM_ERROR%"
          description="" conditionName="isTrue"/>
      <TcLOVValue value="DATA~DATASETS=IMAN_specification~CATPart" description=""
      <TcLOVValue value="ARG-cfg_file=%$CONFIG_FILE%" description="" conditionName="isTrue"/>
	  <TcLOVValue value="ARG-cfg=%$CONFIG_FILE%" description="" conditionName="isTrue"/>
      <TcLOVValue value="ARG-files=%$DATASET_FILE%" description="" conditionName="isTrue"/>
      <TcLOVValue value="CFG~ItemID=%$TARGET.item.item_id%" description="" conditionName="isTrue"/>
      <TcLOVValue value="CFG~ItemRevisionID=%$TARGET.item_revision_id%" description="" conditionName="isTrue"/>
	  <TcLOVValue value="CFG~ItemRevisionName=%$TARGET.object_name%" description="" conditionName="isTrue"/>
	  <TcLOVValue value="CFG~JobTag=%$PROCESS.TAG%" description="" conditionName="isTrue"/>
	  <TcLOVValue value="CFG~PathScriptFolder=\\vtl00-ms036\Catia2Stp" description="" conditionName="isTrue"/>
	  <TcLOVValue value="CFG~PathOutFolder=\\vtl00-ms036\Catia2Stp\Out" description="" conditionName="isTrue"/>
	  <TcLOVValue value="CFG~tcint_userid=%$USER%" description="" conditionName="isTrue"/>
	  <TcLOVValue value="CFG~USERID=%$USER.userid%" description="" conditionName="isTrue"/>



Re: Run external command with workflow help

There are dash's ("-") in a number of places where there should be squiggly's ("~"). Check these:
INPUT-ExportOrigFile should be INPUT~ExportOrigFile
ARG-cfg_file=%$CONFIG_FILE% should be ARG~-cfg_file=%$CONFIG_FILE%
ARG-cfg=%$CONFIG_FILE% should be ARG~-cfg=%$CONFIG_FILE%
ARG-files=%$DATASET_FILE% should be ARG~-files=%$DATASET_FILE%

Here are a couple of examples from my usage: This first one is for extracting MS Word.

Possible arguments for extracting MSWord and PDF datasets…

I hope these are helpful to you.

Randy Ellsworth, Teamcenter Architect, Applied CAx, LLC
NX 11.0.1.mp01 | SW 2016 | TcUA 11.2.3
Evaluating:AW 3.2

Re: Run external command with workflow help

Thanks Randy for finding the dashes... it didn't help all, but it's now making the export with real name instead of the filestorage name so I can skip the renaming step in my script.


What I still get is a freeze when running the workflow.

Rich Client states "Creating New Process" in lower left and "Working..." and wont stop until I kill the process hard in task manager.


My VB script that shall be run looks like this. Rather simple as it just creates a file on disk but I have made it so just to see that it actually runs.


Option Explicit

	Dim fso:    Set fso = CreateObject("Scripting.FileSystemObject")
	Dim basepath: basepath="\\vtl00-ms036\Catia2stp"
	Dim fs1: Set fs1 = fso.CreateTextFile (basepath&"\temp.txt",True)


Running the script manually works fine.


When I copied the VB script file to C:\Temp\Cat2Step and changed in the LOV on INPUT~Application to C drive on instead of  the UNC path I at least didn't get a hung but I still got an error in Rich Client.




Still it seems as the script wasn't run as no text file was created. 


Are you runnnig VB script or only batch files when using ?

Re: Run external command with workflow help

Hi again


... when I also change the path for the exported files I get an error that it's not possible to write the config file.

I have set 'Everyone' and 'Authenticated users' to full access to this export folder. Still failing.





- Which user is actually running the workflow, infodba or some system user?

- Were have you placed the handler EPM-run-external-command in the workflow? I have it on Start.
  Tried with perform and then the workflow went through but it didn't run the script.
  Had it also on Complete and it behaves the same as on Start.




Re: Run external command with workflow help

Sounds like you're running into some permission issues. The person that is running the command is the last person to Approve\Do a task. Automated steps inherit the permissions from the last actual person to touch it. Unless you're running something like Dispatcher which logs in as dcproxy. UNC paths don't work with batch files but should have with VB (or PowerShell).

I just dump the files to a watched folder and move on. Another program actually processes them and cleans up the watched folder. Makes my life a whole lot simpler.

Randy Ellsworth, Teamcenter Architect, Applied CAx, LLC
NX 11.0.1.mp01 | SW 2016 | TcUA 11.2.3
Evaluating:AW 3.2

Re: Run external command with workflow help

Ok so then it's as I thought. It's so strange that I can't write to local C:\ drive.

I also thought that if I just can get the files out I could have a watcher that picks up the files but as I get the haning workflow process when writing to my share and on C drive I can't get access I feel stuck.

Thanks for all the suggestions, I need to do some internal investigations on this I feel.


Two last question Randy,

- have you the the EPM-run-external-command placed on Complete?

- do you have any user interaction in your workflow or is this export just a task in a release workflow?