Highlighted
forumadmin Absent Member.
Absent Member.
5313 views

TeamTrack 6.6/TeamScript - how retrieve "current user" name


Discussion posted 6/17/09 by Samuel Barnes
Details:

The following script that runs "pre-transition" on an "update" loop.

Call Shell.Item.GetFieldValue("current user", cu) ' Person updating the work item
Call Shell.Item.GetFieldValue("TRACKER_OWNER", tro) ' Work Item Owner
If cu=tro Then
cafStr = "(None)"
Call Shell.Item.SetFieldValue("CLIENT_ACTION_FIELD", cafStr)
Else
cafStr="Assigned to V3 Admin"
Call Shell.Item.SetFieldValue("CLIENT_ACTION_FIELD", cafStr)
End If


There are no errors, but the script does not "do" what I intend.
I am trying to circumvent the "required" setting for the "CLIENT_ACTION_FIELD" by automatically setting the field based on the user.

0 Likes
19 Replies
forumadmin Absent Member.
Absent Member.

Re: TeamTrack 6.6/TeamScript - how retrieve "current user" name


Comment posted 6/17/09 by Samuel Barnes

In a nutshell: what I need is to retrieve the "current user"
I have tried: "<current user>" and "(current user)"

0 Likes
forumadmin Absent Member.
Absent Member.

Re: TeamTrack 6.6/TeamScript - how retrieve "current user" name


Comment posted 6/17/09 by mtcarver

I don't think current user is a field unless you created it. It's more of a system background concept not a field. You could create an owner field named Cur_User placed in hidden section then on transition edit field to default to (current user). I don't do many pre-transition scripts but I'm not sure you can do field sets on pre-transition anyway but check the teamscript manual it will tell you what's possible during pre-transition.

0 Likes
forumadmin Absent Member.
Absent Member.

Re: TeamTrack 6.6/TeamScript - how retrieve "current user" name


Comment posted 6/17/09 by mtcarver

on post transition script you could evaluate "Last Modifier" and compare to Tracker_Owner then set the Client_action_field

0 Likes
forumadmin Absent Member.
Absent Member.

Re: TeamTrack 6.6/TeamScript - how retrieve "current user" name


Comment posted 6/17/09 by Samuel Barnes

So, even though we can create rules based on based on the value of (Current User) we can't use that same value for a script? That's odd.
How else could I "reset" the required field "Client_Action_Field" based on the user?

0 Likes
forumadmin Absent Member.
Absent Member.

Re: TeamTrack 6.6/TeamScript - how retrieve "current user" name


Comment posted 6/17/09 by mtcarver

like I said current user is a system background concept. Did you try last modifer compare in a post transition script?

0 Likes
forumadmin Absent Member.
Absent Member.

Re: TeamTrack 6.6/TeamScript - how retrieve "current user" name


Comment posted 6/17/09 by Samuel Barnes

Last modifier was an idea, but not sure what the name for that would be either.
A co-worker just found "Shell.User" in the "TeamScript guide. The description says: "The 'current user' for the script and is always the logged-in user." I think this is what I am seeking but can't figure out the syntax for it yet.

0 Likes
forumadmin Absent Member.
Absent Member.

Re: TeamTrack 6.6/TeamScript - how retrieve "current user" name


Comment posted 6/17/09 by mtcarver

Last Modifier is a system field as long as you created with your solution.

0 Likes
forumadmin Absent Member.
Absent Member.

Re: TeamTrack 6.6/TeamScript - how retrieve "current user" name


Comment posted 6/17/09 by mtcarver

try Shell.User

0 Likes
forumadmin Absent Member.
Absent Member.

Re: TeamTrack 6.6/TeamScript - how retrieve "current user" name


Comment posted 6/17/09 by Samuel Barnes

how do I use Shell.User?
GetDisplayName() as a way to get a "name"?

0 Likes
forumadmin Absent Member.
Absent Member.

Re: TeamTrack 6.6/TeamScript - how retrieve "current user" name


Comment posted 6/17/09 by mtcarver

I'm not exatly sure since I've never used it. I suspect it's very similiar to Shell.Item.
Could be just Shell.User -
try this in a pre-transition script.
Call Ext.LogErrorMsg("User=:" &Shell.User)
if no errors when you pre-transition then check the application event viewer and see if you get the current user. It could be the name or the user ID. If you get the name there's more you'll need to do in order to use it in a compare.

0 Likes
forumadmin Absent Member.
Absent Member.

Re: TeamTrack 6.6/TeamScript - how retrieve "current user" name


Comment posted 6/17/09 by mtcarver

above won't work has to be more to it - I'll search.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.