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)
calling script in workflow
kellyrmilligan
I am prob wimping out on this one, but I just want to read a list of userid's from a central place, and then spit them out in a select drop down at the beginning of a workflow in the tag info section. does anyone have an example of reading a file of some sort in the workflow?
Thanks,
Kelly
Find more posts tagged with
Comments
Jeremy
Teamsite comes with get_names_from_file which is in Teamsite::Usertask.
To call it use something like this:
$author = get_names_from_file(undef, 1, undef, "$roles/author.uid");
then just insert this into your TAG_info section:
iw_author =>
[ html => $author,
label => "Select Author",
],
Not 100% sure what all the different parameters are, but check the Usertask module.
Hope this helps you.
Jeremy
Migrateduser
I keep a separate list of users in a file called userdata.dat in this format:
David Smith,dsmith,DavidH.smith,
Foo Bar,foobar,foo.bar,
.
.
.
and I use that file to display my drop-down select list of users in my TAG_info area, displaying the full names of the users but assigning their login ID as the value that is assigned to the selection like this in my WFT:
my
@user
;
# grab list of Users
if (!open USERS, "<../../conf/roles/userdata.dat")
{
$users_html = "<input type='text' value='--Error opening userdata.dat ---'>",
}
else
{
@user
= <USERS>;
$user = __VALUE__('iw_user');
@user
= map { s/^\s*//gs; s/\s*$//gs; /([^,]+),([^,]+),[^,]*/;
if ($user eq $2) {
$selected = "selected";
}
else {
$selected = "";
}
" <option value='$2' $selected$selected>$1\n";
} sort
@user
;
unshift
@user
, "<select size=5>\n";
push
@user
, "</select>\n";
$users_html = join('',
@user)
;
}
close USERS;
TAG_info(
iw_author => [ html => $users_html,
label => "</strong><font size=-1>" .
"Select Author</font><strong>",
],
);
The only drawback is that I have to maintain that file, but we have so few new users it is not an issue for me.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
kellyrmilligan
Thanks once again, that is pretty much what I want to do as well, read from some config typ file, and populate the select box on the fly. we are using this to select the reviewer in an easier fashion, so that the email can be sent to that person selected.
Question: for your file format, the first one is the Regular name, the second and third parts, I am not sure about, one is a network id I think, and the other a teamsite id?
thanks,
Kelly
Migrateduser
Yes, sorry I should have explained what the entries in the file meant. The first entry is the user's full name - what they will see in the drop-down list. The second entry is their TeamSite login name, and the third is the prefix of their email address. The email address is not used in this context.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
kellyrmilligan
are you using the email map file?
Migrateduser
I'm using the email_map.cfg file that works with the template based email script in the /solutions directory. The reason the email prefix is in the config file I mentioned in this thread is to satisfy old email scripts that we no longer use. For all intents and purposes, only the first 2 entries really need to be in the config file for the select list.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
kellyrmilligan
that is what I figured, just wanted to check.
Thanks,
Kelly