cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

How to/Can you export a document (using a Gateway Export Wizard template) via a trigger?

mbeck
3-Newcomer

How to/Can you export a document (using a Gateway Export Wizard template) via a trigger?

I am wondering if it is possible to export a document via a trigger, but I would like to be able to select a template item from the Gateway Export Wizard.

Additionally, I would then like to be able to take the exported document and send via e-mail attachment in the trigger.

Does anybody know if this is doable?

ACCEPTED SOLUTION

Accepted Solutions
mrump
16-Pearl
(To:mbeck)

Doable, YES.

Recommended, IMHO NO.

1. The main point is that the server side trigger framework depends on "quick responding" triggers scripts, as a running script is a "blocking" single task.

The export of document can take up to minutes, based on the size of the document and it's attachments. During the export no other trigger script can be performed which might lead to nasty user experience in other areas.

2. you would need a installed client (that contains the gateway) on your server machine. Performing exports on your server would also store all the temporary data that is needed on your server machine. So you would need extra maintenance and care to cleanup your server's file-system after an export.

We use a design where the trigger in integrity only "fires" and event that is performed by a second server (Jenkins). The Jenkins Server performs the export just as any other build job in a temporary workspace and cares for archiving result and cleaning up temporary files itself.

HTH Matthias

View solution in original post

5 REPLIES 5
mrump
16-Pearl
(To:mbeck)

Doable, YES.

Recommended, IMHO NO.

1. The main point is that the server side trigger framework depends on "quick responding" triggers scripts, as a running script is a "blocking" single task.

The export of document can take up to minutes, based on the size of the document and it's attachments. During the export no other trigger script can be performed which might lead to nasty user experience in other areas.

2. you would need a installed client (that contains the gateway) on your server machine. Performing exports on your server would also store all the temporary data that is needed on your server machine. So you would need extra maintenance and care to cleanup your server's file-system after an export.

We use a design where the trigger in integrity only "fires" and event that is performed by a second server (Jenkins). The Jenkins Server performs the export just as any other build job in a temporary workspace and cares for archiving result and cleaning up temporary files itself.

HTH Matthias

mbeck
3-Newcomer
(To:mrump)

Thank you, Matthais, for the great information.  I understand the drawbacks of doing it this way; it seems like it would cause a lot of server headaches.

This was in attempt to try to export a document during review process that could e-mail the document to non-PTC Integrity users.  My supervisor was hoping to use a particular template format for export.   I guess my other option is to just call a 3rd party executable that could run in the background to generate a document export and e-mail.

Thanks again for the info.

To get the best of both worlds, you could have the trigger send a message to another process, which would independently make the command line calls.  If you wanted to minimize the lifting within the trigger, you could have your other process be kicked off by an email sent from an emailAdvanced trigger, with the content of the message being the document ID and maybe the export configuration to use.  This would let your trigger complete quickly, but still produce the content for you. 

The harnessing challenge, then would be having an email handler kick off your process, rather than having JavaScript kick it off.  The difficulty is probably comparable, but you have the benefit of freeing the scheduled triggers queue relatively quickly.

If turn-around time wasn't a factor, you could even queue the processing to happen during off hours, assuming you're not a 24/5 or 24/7 shop.

Regards,
Kael


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager

Hello Martin,

This certainly isn't something that Integrity Lifecycle Manager will do out of the box.  While I'm not certain it's doable, I can provide some more information.

  • Gateway export is actually a client-side process, and triggers are server side, so to make this work, at a minimum you will need to install a client on the server host in such a way that the user running the server process can also access the client, and a way to make a call from JavaScript to the CLI.
  • Since Gateway export to Microsoft Word is only supported on a Windows client, your server needs to be a Windows server, or you need to engage in some clever and unsupported trickery to invoke a Windows client from a non-Windows Integrity server trigger--this isn't something I've delved into, so I have no recommendations on this.
  • Trigger recipes are written in JavaScript, so if you could get to a command line, you could export it by calling the gateway.exe command on in the bin directory of a client installed on the server.  The command for export will be from the client's bin directory:
    gateway export --user=USERNAME --password=PASSWORD --hostname=SERVERHOST --port=SERVERPORT --config="NAME_OF_EXPORT_CONFIGURATION" --file="PATH_TO_FILE_TO_BE_EXPORTED" --silent DOCMENT_ID
    If the --silent is ommitted, it should open up the wizard to confirm values.
  • Once you have the file, you need to be able to send it as an attachment.  Since at this point you should already have access to a command line, and you should have a path to the exported document, this should be fairly straight forward

So yes, I think it's doable,

Regards,
Kael


I see Matthias beat me to the punch here.  His point about blocking is particularly pertinent, if you're trying to export a large document.


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager
mbeck
3-Newcomer
(To:KaelLizak)

Kael,

Thanks for the additional information.  I think this should definitely help with what I'm trying to accomplish.  I think using Javascript to call the command line with gateway.exe is the way to go. 

Thanks again.

Regards,

Martin

Announcements


Top Tags