Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Assigning newjob with/without attachments
webkicha
I'm new to TS. Hope some one out there to have this piece of cake. I designed a workflow using WFB. It is working absolutely fine when there is any attached file to it. But i have situations where I need to intiate the job without any attachments. How can i do that? Thanx in advance.
Find more posts tagged with
Comments
Adam Stoller
It would probably help if you could post the generated wft (not the wfb) - as an attachment so we could look at it.
Also - what version of Workflow Builder are you using?
--fish
(Interwoven Senior Technical Consultant)
webkicha
I'm using WFB5.5.2.
Below is the .wft file
-----------------------------------
use TeamSite::Config;
(my $iwhome = TeamSite::Config::iwgethome()) =~ tr|\\|/|;
#=====================================================================
# Name: iw_cleanup_paths
# Args: bp - branch path
# wa - workarea name
# Usage: ($b, $w, $a) = iw_cleanup_paths($bp, $wa);
# Purpose: Function used to clean up leading and trailing blanks
# from branch path and work area path, then derive
# $areavpath.
# Returns: Cleaned branch path, workarea, and generated areavpath
#=====================================================================
sub iw_cleanup_paths {
my ($bp, $wa) =
@_
;
# clean up leading and trailing slashes so we don't
# end up hassling the user over including/excluding them
$bp =~ s|^\s*/*([^/].*\S)/\s*$|$1|;
$wa =~ s|^\s*/*([^/].*\S)/\s*$|$1|;
#=# (Note - this code may need to change when we start supporting
#=# multiple archives [Arnold])
$bp = "main/$bp" if ($bpath !~ /^main/);
$areavpath = TeamSite::CGI_lite::escape_html_data(
"/default/$bp/WORKAREA/$wa");
return ($bp, $wa, $areavpath);
}
#=====================================================================
# Name: iw_set_area
# Args: btag - TAG_info variable name for branch path.
# watag - TAG_info variable name for workarea.
# Usage: ($a, $b, $w, $s) = set_area("$btag", "$watag");
# Purpose: If the built-in variables for branch and workarea have
# not been set, pull the information from the workflow
# instantiation form (using the btag and watag info).
# Use the branch and workarea information to generate
# a valid areavpath (using a library routine)
# Returns: Returns the generated areavpath, the branch path, the
# workarea name, and a boolean indicating whether or not
# the branch and workarea need to be prompted for during
# instantiation (this relies on the fact that this code
# is run multiple times during the instantion process).
#=====================================================================
sub iw_set_area{
my($btag, $watag) =
@_
;
my($avpath, $bpath, $wapath, $skip);
my($iwbpath, $iwwapath) = (__VALUE__("iw_branch"),
__VALUE__("iw_workarea"));
if ((length($iwbpath)) > 0 && (length($iwwapath)) > 0){
$bpath = $iwbpath;
($wapath = $iwwapath) =~ s|^\s*/.*
|;
$wapath =~ s|/\s*$||;
return("$wapath", "$iwbpath", "$wapath", "TRUE");
}
($bpath, $wapath, $avpath) = iw_cleanup_paths(__VALUE__("$btag"),
__VALUE__("$watag"));
return("$avpath", "$bpath", "$wapath", "FALSE");
}
my($iw_area_vpath, $iw_branch_path, $iw_work_area, $iw_skip_branch) =
iw_set_area("branch_path", "work_area");
#======================================================================
# Name: iw_get_mail_cmd
# Args: type - either "iwsend_mail" or "iwsend_servlet_mail"
# addr - 'To:' email address
# Usage: __INSERT__(iw_get_mail_cmd("$type", "$addr"));
# Purpose: This function generates the command statement called
# by the external email notification task.
# Returns: Returns the generated XML string.
# Note: Defaults to iwsend_servlet_mail.ipl unless $type is
# explicitly set to iwsend_mail
#=# (this will hopefully change with the next version of iwsend_mail)
#=# (when that happens, either drop type, or make it a second
#=# [optional] argument, that if set - assumes the program lives in
#=# iw-home/local/bin ?)
#=====================================================================
sub iw_get_mail_cmd {
# NT lacks the ability to bind a script executor with a
# script on a 'shebang' line (eg: #!/blah/blah/iwperl)
# Instead it uses the assoc/ftype mechanism which employs
# the use of environment variables that are not always
# available (cf: IIS's metabasse, which replicates the
# extention-based association scheme on its own). Therefore,
# we need to spoon-feed iwperl the script like this for now:
my($type, $taskName, $addr) =
@_
;
return(sprintf("<command v='%s$iwhome/bin/%s %s'/>",
($^O eq "MSWin32") ? "$iwhome/iw-perl/bin/iwperl " : "",
($type eq "iwsend_mail") ?
"$type.ipl" : "iwsend_servlet_mail.ipl",
($taskName eq "" ) ? $addr: "$taskName $addr"));
}
#=====================================================================
# Name: iw_getrole
# Args: role - basename of a TeamSite role (*.uid) file, or
# similarly constructed customized file in the
# same directory.
# Usage: $html = iw_getrole("master");
# Purpose: Generate an HTML formatted drop-down menu of all
# entries in named file for use within a TAG_info()
# section.
# Returns: Returns the generated drop down list on success, or
# a text field with an error message if it was unable
# to open the file.
#=====================================================================
sub iw_getrole{
my($role) =
@_
;
$role .= ".uid" if ($role !~ /\.uid$/);
my($html) = "";
if (!open(IN, "<$iwhome/conf/roles/$role")){
$html = "<input type='text' value='--Error opening $role--'>";
}
else {
$html = "<select size='1'>\n<option>\n";
foreach (sort(<IN>)){
s/^\s*//gs; s/\s*$//gs;
$html .= "<option>$_\n";
}
close(IN);
$html .= "</select>\n";
}
return($html);
}
#=# (changed reference to renamed subroutine)
my($iw_admin_html) = iw_getrole("admin");
my($iw_masters_html) = iw_getrole("master");
my($iw_authors_html) = iw_getrole("author");
my($iw_editors_html) = iw_getrole("editor");
#=====================================================================
# file list for start task
#=====================================================================
my($iw_selected_files) = iw_get_filelist();
#=====================================================================
# Name: iw_get_filelist
# Args: None.
# Usage: $xml = iw_get_filelist();
# Purpose: Generate an XML formatted list of all the files that
# were pre-selected when the workflow was initiated.
# Returns: Returns the XML formatted list if files were selected.
# Returns an empty string if no files were selected.
# Notes: Sorts the filelist in uuencode form, then html-encodes
# each entry using a library routine - all this using
# the Sambre-Janken transform algorithm
#=====================================================================
sub iw_get_filelist{
my($files) = "";
if (__ELEM__('iw_file')){
my(
@flist)
= map {
TeamSite::CGI_lite::escape_html_data($_);
} sort map {
tr|\\|/|;
s|^\Q$iw_area_vpath\E||;
$_;
} __VALUE__('iw_file');
$files = "<files>\n";
for (my $i = 0; $i <
@flist
; ++$i) {
$files .= "\t<file path='$flist[$i]' comment='task file'/>\n";
}
$files .= "</files>\n";
}
return($files);
}
##############################################################################
my $sOwner = __VALUE__('iw_user');
my $sVpath = __VALUE__('iw_use_default');
my $uAuthor = __VALUE__('uAuthor');
TAG_info(
uAuthor => [html => "$iw_authors_html", is_required => 'true', label => "Author",],
iw_debug_mode => "<input type='text' value='true'>",
);
]]>
</template_script>
<workflow name = "WS_JobAssignment" owner = "__INSERT__($sOwner);" creator = "__TAG__('iw_user');">
<externaltask lock = "f" name = "EmailAuthor" owner = "__INSERT__($sOwner);" retry = "f" start = "t">
<areavpath v = "__INSERT__($sVpath);"/>
<successors>
<successorset description = "Go to Author">
<succ v = "Author"/>
</successorset>
</successors>
<command v = "c:/iw-home/iw-perl/bin/iwperl c:/iw-home/bin/iwsend_mail.ipl -H __INSERT__($uAuthor);"/>
__INSERT__($iw_selected_files);
<activation>
<or>
<pred v = "Approver"/>
</or>
</activation>
</externaltask>
<usertask lock = "f" name = "Author" owner = "__INSERT__($uAuthor);" start = "f" readonly = "f">
<areavpath v = "__INSERT__($sVpath);"/>
<successors>
<successorset description = "Done">
<succ v = "EmailApprover"/>
</successorset>
</successors>
<activation>
<or>
<pred v = "EmailAuthor"/>
</or>
</activation>
</usertask>
<externaltask lock = "f" name = "EmailApprover" owner = "__INSERT__($uAuthor);" retry = "f" start = "f">
<areavpath v = "__INSERT__($sVpath);"/>
<successors>
<successorset description = "Go to Approver">
<succ v = "Approver"/>
</successorset>
</successors>
<command v = "c:/iw-home/iw-perl/bin/iwperl c:/iw-home/bin/iwsend_mail.ipl -H __INSERT__($sOwner);"/>
<activation>
<or>
<pred v = "Author"/>
</or>
</activation>
</externaltask>
<usertask lock = "f" name = "Approver" owner = "__INSERT__($sOwner);" start = "f" readonly = "f">
<areavpath v = "__INSERT__($sVpath);"/>
<successors>
<successorset description = "Reject">
<succ v = "EmailAuthor"/>
</successorset>
<successorset description = "Approved">
<succ v = "Submit"/>
</successorset>
</successors>
<activation>
<or>
<pred v = "EmailApprover"/>
</or>
</activation>
</usertask>
<submittask name = "Submit" owner = "__INSERT__($sOwner);" start = "f" unlock = "t" override = "t" skiplocked = "f" savecomments = "t" skipconflicts = "t">
<areavpath v = "__INSERT__($sVpath);"/>
<successorset description = "Go to Deploy">
<succ v = "Deploy"/>
</successorset>
<activation>
<or>
<pred v = "Approver"/>
</or>
</activation>
</submittask>
<externaltask lock = "f" name = "Deploy" owner = "__INSERT__($sOwner);" retry = "f" start = "f">
<areavpath v = "__INSERT__($sVpath);"/>
<successors>
<successorset description = "Go to EndTask">
<succ v = "EndTask"/>
</successorset>
</successors>
<command v = "c:/iw-home/iw-perl/bin/iwperl c:/iw-home/local/config/wft/solutions/wft_opendeploy.ipl"/>
<activation>
<or>
<pred v = "Submit"/>
</or>
</activation>
</externaltask>
<endtask name = "EndTask">
<activation>
<or>
<pred v = "Deploy"/>
</or>
</activation>
</endtask>
</workflow>
james1
Your WFT always adds $iw_selected_files to the job spec.
$iw_selected_files always contains a <files> element.
The iwwf.dtd says that the <files> element must have at least one <file> sub-element.
When there are no selected files, your iw_get_filelist() method does not add any <file> sub-elements to its <files> sub-element. This results in an invalid job specification document.
You should either: (1) add $iw_selected_files conditionally, based on whether or not there were any selected files, or (2) make iw_get_filelist() return an empty string (instead of "<files></files>") when there were not any selected files.
-- James
--
James H Koh
Interwoven Engineering
Adam Stoller
Actually, as the code is written - iw_selected_files *should* be the empty string ("") if (__ELEM__('iw_file') == 0) - but the best way to check out what's happening is probably to enable the 'debug' mode and look at the generated job description file (the 'green' part of the debug-mode screen) and see what the initial externaltask looks like there.
--fish
(Interwoven Senior Technical Consultant)