Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Instantiating a workflow from a custom menu item
System
I'm trying to setup a custom menu item to instantiate a new job from a particular workflow template. I want the job to automatically attach the files that were selected when the custom menu item was chosen. Does anyone have a good suggestion on how to accomplish this?
Thanks,
Jason
Find more posts tagged with
Comments
Migrateduser
Your custom menu script gets passed specific form key/value pairs with lots of good information, including any preselected files. The form keys
path_0, path_1, ...
contain the full path to each file/directory selected. You can then format these values however you need to and pass them to your wft file.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
akshathp
Depends how you are trying to make a call to this workflow.
1. If it is via hyperlink then you can send the filenames as query string.
2. If you have a form with post method then you can have hidden name/value pair for the filenames.
How exactly are you trying to call the wft from your custom menu item script?
Hope this helps!
Akshat Pramod Sharma
Interwoven Inc.
Migrateduser
I think I'm looking for more specific information, like what the name value keys should be. Also wanting to know how you "pass them to your wft file." You can't just call a wft file, so I'm looking for more information on exactly what I need to call. Is it iwwft_instantiator.cgi? If so, how do you get it to attach files upon creation of the job?
Migrateduser
I think I need more of a code-level explanation. I'm trying to instantiate the workflow using iwwft_instantiator.cgi, but I can't see any way to attach files when starting a workflow this way. Also, I tend to get lots of errors upon instantiation which I don't get when I start the workflow through the submit or new job menu items.
akshathp
In your custom CGI have a hyperlink or form to post this URL
http://tsserver.domainname.com/iw/webdesk/login/iw-bin/iwwft_instantiator.cgi?Article_ID=&iw_branch=/default/main/branchname&iw_first_time=true&iw_home=/iw-home&iw_role=editor&iw_session=NotUsed_anymore&iw_template_file=default/workflow_template.wft&iw_template_name=WorkflowHeading&iw_use_defaults=false&iw_user=username&iw_workarea=/default/main/branchname/WORKAREA/workareaname&iw_file=/default/main/branchname/WORKAREA/workareaname/folder/sub-folder/file.html&user=username&domain=domainname&role=Editor
Note, you would need to have a dynamic list of filenames if the filenames are more then one. This example is only for one file.
Hope this helps!
Akshat Pramod Sharma
Interwoven Inc.
Migrateduser
Can you provide an example of a dynamic filelist using this approach? Say if there were 3 files, how would the URL need to look? Do you just make up your own file keys (iw_file1,iw_file2,iw_file3) and then also pass a count variable (iw_count) so the wft file can figure out how many files it needs to grab?
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
Migrateduser
This was extremely helpful. Was wondering what you mean by a dynamic list of file names? Can I put multiple "&iw_file=" on the same query string?
akshathp
Actually in the name/value pair for iw_file, the name remains cosntant for entire list of files. So, if you have three files "file1", "file2" and "file3", the list would be
...iw_file=file1&iw_file=file2&iw_file=file3...
http://tsserver/iw-bin/iwwft_instantiator.cgi?iw_session=$session&iw_branch=/default/main/branchname&iw_workarea=$area&iw_user=$username&iw_wftask=true&iw_use_defaults=true&iw_template_file=default/customscript.wft$flstr
In the above code you wil notice there are couple of values in my query string which are actually variables. So values like username, session etc I fetch from the cookie. And the value for filenames I pass as a variable called "flstr". This flstr variable I create dynamically at the start of the script where I basically concatenate the filenames as name value pair.
$flstr .= "\&iw_file=" . $name;
I run this concatenation wihtin a foreach loop for all the files that were selected. So you will see that in this concatination of name value pairs, the name "iw_file" is a constant whereas the filename is varibale as "$ name"
Hope this helps!
Akshat Pramod Sharma
Interwoven Inc.
Migrateduser
Ok, I'm trying this with the Author Assignment workflow. I continue to get errors. When I go into debug mode, it shows this:
Errors In Specification Generator!
Can't continue after import errors at (eval 5) line 114
BEGIN failed--compilation aborted at (eval 5) line 114.
Here's line 114:
[ 114] use TeamSite::Uniscape::uniscape qw(UTF8ToNative_2);
Any assistance would be greatly appreciated.
Thanks,
Jason
akshathp
I hope you are using this url
http://tsserver/iw-bin/iwwft_instantiator.cgi?iw_session=$session&iw_branch=/default/main/branchname&iw_workarea=$area&iw_user=$username&iw_wftask=true&iw_use_defaults=true&iw_template_file=default/customscript.wft$flstr
Note that I have fetched session value and usernames in variables. These variables I created by reading the TS cookie at the start of the script.
Can you please post the script you are using? I need to check the URL that you are using.
Thanks!
Akshat Pramod Sharma
Interwoven Inc.
Migrateduser
Here is the exact URL I'm using:
http://sandbox/iw-bin/iwwft_instantiator.ipl?user_name=teamsite\jason&iw_template_file=default/author_assignment.wft&iw_first_time=true&iw_home=c:\iw-home&iw_session=NotUsed_anymore&iw_branch=/default/main/sandbox&iw_role=master&iw_session=52616e646f6d4956560eec5a66e364fe1151b0fb9536a1259d3af82da1e773cfa607b81b117a0b435757fd247240e9f8e749ca8a769ba9dfa3ad1ed25d198c56&iw_workarea=/default/main/sandbox/WORKAREA/sandbox&iw_user=teamsite/jason&iw_use_defaults=true
I get an error when I go to this URL.
- Jason
Migrateduser
Akshat, I certainly appreciate what you're trying to do, and it's great info for an undocumented way to kick off a wft. However, if you only give half the answer, it's not nearly as helpful. If you could provide the complete answer, including how you filled in all your variables (like $session), that would fill in all the blanks. How do you get this information from the cookie?
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
Migrateduser
A lot of the variables (like session) are passed to the cgi script when the custom menu item is chosen. This includes the user name, role, session, files selected, vpath, workarea, and several others. For a complete list, add a custom menu item that calls show_env.cgi
Migrateduser
Oh duh...that's the same place that the path_x variables come from. My apologies, Akshat. I had a brain fart. Thanks, Jason.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
akshathp
Dave, I understood your point. Here are some more details. I have used cookie values as I am using this same script in many different calls. So, I couldn't just rely on the default values being passed. However, ofcourse if the way to call this script is always from as a custom menu item, then cookie is not required as these values are already available.
# ---------------------------------------------------------------------------
# This is how I contruct a dynamic list of all the files
# as name/value pairs. You will notice that the list has
# iw_file as the constant name and $ name gives the
# filename
# ---------------------------------------------------------------------------
my($flstr) = "";
foreach my $name (
@files)
{
$flstr .= "\&iw_file=" . $name;
}
#---------------------------------------------------------------------------
# This is how I read the cookie value for TeamSite
# session that gives me session value and username
#---------------------------------------------------------------------------
my($session) = $ENV{HTTP_COOKIE};
my(
@ckie_main)
= split (/\;/,$session);
my($ckie11) = "";
my($ckie12) = "";
my($ckie31) = "";
my($ckie32) = "";
foreach my $ckie_mn (
@ckie_main)
{
if ($ckie_mn =~ /IWAUTH/i)
{
($ckie31, $ckie32) = split (/\=/,$ckie_mn,2);
}
if ($ckie_mn =~ /user/i)
{
($ckie11, $ckie12) = split (/\=/,$ckie_mn,2);
}
}
$username = $ckie12;
$session = $ckie32;
# --------------------------------------------------------------------------------
# This is how I construct my final URL for the call to my custom wft
# You will notice it includes the variables whereever applicable
# I have used variables for session, workarea, username and filename
# Value for session and username I fetch from cookie as mentioned above
# Value for area I get in this CGI default on each call as a standard procedure
# for workflow custom scripts.
# Value for filename I get as mentioned above.
#---------------------------------------------------------------------------------
my($url) = "
http://tsserver/iw-bin/iwwft_instantiator.cgi?iw_session=$session&iw_branch=/default/main/branchname&iw_workarea=$area&iw_user=$username&iw_wftask=true&iw_use_defaults=true&iw_template_file=default/myworkflowfile.wft$flstr
";
print "Location: $url\n\n";
# This final print statement with Location is to redirect the same browser to open the workflow.
Thanks!
Akshat Pramod Sharma
Interwoven Inc.
akshathp
This iwwft_instantiator is the CGi you need to invoke. Not an ipl
You are using
http://sandbox/iw-bin/iwwft_instantiator
.
ipl
?user_name=teamsite\jason&iw_template_file=default/author_assignment.wft&iw_first_time=true&iw_home=c:\iw-home&iw_session=NotUsed_anymore&iw_branch=/default/main/sandbox&iw_role=master&iw_session=52616e646f6d4956560eec5a66e364fe1151b0fb9536a1259d3af82da1e773cfa607b81b117a0b435757fd247240e9f8e749ca8a769ba9dfa3ad1ed25d198c56&iw_workarea=/default/main/sandbox/WORKAREA/sandbox&iw_user=teamsite/jason&iw_use_defaults=true
Call the instantiator.
cgi
Hope this helps!
Akshat Pramod Sharma
Interwoven Inc.
Adam Stoller
Akshat,
Is there any reason you go to all that trouble instead of just using a TeamSite::CGI_lite object and doing stuff like:
my $session = $cgi->{form}{session};
my $user = $cgi->{form}{user_name};
-or-
my $session = $cgi->{cookie}{IWAUTH};
my $user = $cgi->{cookie}{iw_user};
Just curious...
--fish
(Interwoven Senior Technical Consultant)
Migrateduser
Unfortunately I get the same results whether with the .ipl or .cgi.
akshathp
I did that as this same script I am using for various other calls to the workflow. Which includes a call to workflow from production site. I have a call from Intranet to workflow where it would first let the user authenticate and then would fetch the values from cookie and proceed further.
I understand what I am using is a quick and dirty way to resolve the issue. Thanks for pointing out the CGI_lite method. I will work on that and probably wouldn't need to check cookie value at all.
Thanks!
Akshat Pramod Sharma
Interwoven Inc.
akshathp
I tried the URL that you are using with some changes to the servername and branchname etc and it works like a champ for me.
Which TeamSIte version are you working on?
Akshat Pramod Sharma
Interwoven Inc.
Migrateduser
I'm on TS 5.5.2 on NT. I had someone test the URL on Solaris and they say it works fine. But I need it to work in NT too, if possible.
akshathp
The test server I worked on was NT too. And it worked.
Akshat Pramod Sharma
Interwoven Inc.
herald10
Hi,
I am facing a strange problem. From a workflow I am deploying files using iwodstart. After completing some instances of the WF the open deploy Fails. Any clue?
Thanks.
Adam Stoller
You'd need to look the OpenDeploy logs to see if you can see reasons for the deployment failing and deal with those.
You also might try calling IWODHOME/solutions/perl/iwodstart.ipl -- some people have gotten better results using that, on Windows, from within workflow than they have using IWODHOME/bin/iwodstart.bat
Beyond that, folks here would need to see the script you are using to perform the deployment.
--fish
(Interwoven Senior Technical Consultant)