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)
WORKFLOW-FILE
System
Hi,
Is there any way we can find out particular file or DCR is already submitted for approval process( work flow)?
If i selected particular DCR for approval process. If user comes again and selected same DCR for approval process is there any way stop with message ??
Thanx in advance
Find more posts tagged with
Comments
jbonifaci
krishna,
I'm not sure if this is the best way, but here's something I've done in the past. You loop through all of the submitted files in your wft and do a `iwgetfilejobs file` on each one and then check the return value for "job=". Here's a sample sub routine that does this and returns an error message with the list of file(s) that are already in another workflow:
sub validateFiles
{
my $error = "";
my $filesInWf = "";
foreach my $file (
@submit_file)
{
my $result = `$iwhome/bin/iwgetfilejobs $area_vpath$file`;
if ($result =~ /job=/s)
{
$error = "<font color='ff0000'>Cannot instantiate workflow, the following file(s) you<br> are trying to submit are already in workflow:</font><br>";
$filesInWf .= "<li>$file</li>\n";
}
}
if ($filesInWf ne "")
{
$error .= "<ul>\n$filesInWf</ul>\n";
}
return($error);
}
It assumes that
@submit_file
is defined as the array of all files submitted, $area_vpath is defined as the workarea path and $iwhome is defined as the path to iw-home. I then take the return from this and create a hidden variable with the length of the error:
my $validFilesError = validateFiles();
my $validFilesHtml = "<input type='hidden' value='" . length($validFilesError) . "'/>";
And then add a TAG for it:
TAG_info(
iw_valid_files =>
[ html => "$validFilesError
$validFilesHtml",
error_msg => 'You can not submit an invalid file.',
valid_input => 'validFileValidator()',
],
);
This tag uses a validFileValidator to validate the input for 'iw_valid_files', which will be the hidden variable we assigned the length of the error message to:
sub validFileValidator
{
if ($iw_valid_files eq "0")
{
return 1;
}
return 0;
}
This assumes that you have defined $iw_valid_files as:
my $iw_valid_files = __VALUE__('iw_valid_files');
You should be able to do this or something similar to get what you want.
Hope this helps,
Jeff Bonifaci
Migrateduser
Thanx for your reply.
It helps