How do I pass a parameter to template file

Options
SriniYA
edited July 20, 2021 in TeamSite #1
Hi,

I am using TeamSite 5.5.2 SP3 and Some patches on Solaris.

I am using Workflow external task to generate .mail file from DCR. I would like to pass one parameter (File path) to a .tpl file. In the .tpl file I would like to read that file.

Any help is appreciated .

Comments

  • What file path are you talking about? The DCR, PT, and/or output file are accessible within the PT using iw_perl directives (iwpt_get_dcr_name(), etc.)

    If it's an arbitrary file - and you're using iwpt_compile.ipl - you might be able to use the -iw_pt-arg flag to pass in a file path (haven't used it myself, but I assume it allows you to do this kind of thing), however you'll also be responsible for setting TST EAs on the generated file yourself since iwpt_compile.ipl won't do that for you.

    If you're using iwgen, you get the EAs for free, but you don't get to pass in a parameter. In that case you could have the externaltask set a specific EA on the DCR and have the PT extract it, or create a temporary file in the same directory as the DCR with a name like <dcr>.fname and have the PT slurp the information in from there or something along those lines.

    --fish
    Senior Consultant, Quotient Inc.
    http://www.quotient-inc.com
  • Thanks

    I would like to pass one txt file path.
    How do i receive -iw_pt-arg parameter in the tpl file
  • To receive an argument use the $iw_arg hash like so:
    $filename = $iw_arg{"file"};

    Where "file" is the parameter passed from the iwpt_compile.ipl script:
    .... -iw_pt-arg file \"fullpathhere\"
TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs