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)
Group list for workflow perl snippet
Bhargav Coca
I am doing this snippet to generate a users list for my workflow, I am trying to use the command "NET LOCALGROUP <groupname>" it is returning some users with success line at the end, is this the right command to generate a user list for a group in the workflow or is ther anyther way.
Here is my snippet.
my($roles) = "$iwhome/tmp";
open (LOG, ">$iwhome/tmp/array.log");
my $getting_group_list = "$iwhome/bin/NET LOCALGROUP VSD > $iwhome/tmp/vsd.uid";
print LOG "MY Command ####### : $getting_group_list\n";
my $command = `$getting_group_list`;
print LOG "Command %%%%%: $command\n";
my($reviewer_html) = get_names_from_file(undef, 5, "multiple",
"$roles/vsd.uid");
TAG_info(
"Reviewer" =>
[ html => $reviewer_html,
is_required => 'true',
label => 'Select Reviewer',
],
);
}
Thank you
Find more posts tagged with
Comments
Adam Stoller
Try this:
use Win32::NetAdmin;
sub get_group_members{
my $groupname = shift;
my
@users
;
Win32::NetAdmin::LocalGroupGetMembers(q{}, $groupname, \
@users)
;
return \
@users
;
}
my $u_list = get_group_members("VSD");
print "VSD:\n\t" . join("\n\t", @{$u_list}) . "\n";
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Bhargav Coca
I have placed your snippet in the right place, it gives me Internal Error on my workflow GUI. Never starts it.
use Win32::NetAdmin;
sub get_group_members{
my $groupname = shift;
my
@users
;
Win32::NetAdmin::LocalGroupGetMembers(q{}, $groupname, \
@users)
;
return \
@users
;
}
my $u_list = get_group_members("VSD");
print "VSD:\n\t" . join("\n\t", @{$u_list}) . "\n";
#my($reviewer_html) = get_names_from_file(undef, 5, "multiple", "$u_list");
TAG_info(
"Reviewer" =>
[ html => $u_list,
is_required => 'true',
label => 'Select Reviewer',
],
);
}
Thank you
Bhargav Coca
IT works when running from a commandline. But when i inserted this in a workflow it gives me the internal error., is my reference to the list which is generated is correct?
TAG_info(
"Reviewer" =>
[ html => @{$u_list},
is_required => 'true',
label => 'Select Reviewer',
],
);
}
i think i am doing wrong here. Please advice.
Thank you
nipper
how about
html => $u_list,
Bhargav Coca
Nope it doesn't work, it just returns an array not the values of the array. Any other suggestion please
Thank you
Adam Stoller
Uhm - it won't work in a workflow because it's trying to print to STDOUT.
You need to replace the printing code for the workflow. If you want a select list - you could do something like this:
...
my $u_list = get_group_members("VSD");
my $u_html = qq{<select size='1'><option/>\n<option>}.join("</option>\n<option>", @{$u_list}).qq{</option>\n</select>\n};
...
"Reviewer" => [html => $u_html,
...
],
...
You need to learn to take the examples provided in the forum and modify them to fit your scenario.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Bhargav Coca
Thank you Fish, it worked perfect, i have included multiple entry in it too.
Thank you
Bhargav Coca
I am following this post , the reviewers list is turning out fine . In my approver/Reveiwer task, it is taking in the reviewers value with out the domain name. I want to insert domain name not in the list but outside the list. How do i include domain name after i get my reviewer from the following snippet.
TAG_info(
"Reviewer" =>
[ html => $u_html,
is_required => 'false',
label => 'Select Reviewer',
],
);
Thank You
jbonifaci
The code you posted has nothing to do with getting your reviewer. It is adding a tag info item called "Reviewer" to your instantiator cgi.
As far as how to add the domain name, that probably means you are removing it somewhere. Why are you removing it in the first place?
~Jeff
Bhargav Coca
I am removing the domain name from anywhere. My reviewers list is names with out domain name before them, so when i select a reviewers from this multiselect box, i am getting the users name and is passed to approver stage as it is, here is my approvers stage, and my approvers stage doesn't like this, because it is expecting a dmain name for that particular user.
open (NLOG, ">$iwhome/tmp/debugfileforme.log");
my($review) = __VALUE__('Reviewer');
print NLOG "$review\n";
$review=~m/([^\/\\]+)($)/;
print NLOG "$review\n";
$review=$1;
print NLOG "$review\n";
$review="NECWEB\\$1";
print NLOG "$review\n";
close (NLOG);
<usertask name="Approver"
owner="__TAG__('$review');"
description="Author Content Approval ( __TAG__('iw_submit_comment'); )"
readonly="t">
<areavpath v="__TAG__('iw_workarea');"/>
<successors>
<successorset description="Approve">
<!-- <succ v="Deploy"/> -->
<succ v="Submit"/>
</successorset>
<successorset description="Reject">
<succ v="Email_AuthorWork"/>
</successorset>
</successors>
<activation>
<pred v="Email_Approver"/>
</activation>
</usertask>
Thanks
jbonifaci
So what you're saying is that your Reviewer select is populated, it doesn't have the domain on the user name. How is the Reviewer select being populated? Odds are there is code that is removing the domain name before populating the reviewer list. I would suggest removing or altering this code so that you get the full domain user name from the Reviewer select.
~Jeff
Bhargav Coca
I'll try
Thank you
Adam Stoller
From an earlier post:
Win32::NetAdmin::LocalGroupGetMembers(q{}, $groupname, \
@users)
;
Since you are passing in
q{}
for the first parameter - I believe the domain name is left off the return value (if memory serves correctly) - if instead, you populate that with the name of the local domain - the domain name will (I believe) be attached to the return values.
Of course - since this is a LocalGroup - it is possible that you could just figure out what the domain is for the local server and stick it on yourself afterwards.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com