PLM 360 General Discussion

PLM 360 General Discussion

Reply
Member
rcoffey2
Posts: 4
Registered: ‎04-11-2012
Message 1 of 5 (158 Views)

Getting the Author of Item

158 Views, 4 Replies
04-20-2012 08:56 AM

Is it possible to return the creater (owner) of an item to use in that items fileds. For example if you wanted each item created in a workspace to contain the Auhor of that item. Seems like I should be able to do that as a computed field, but have failed to figure it out. Also looked at a script and did not get anywhere. Your guidance is appreciated, seems like there has to be a way to do this. 

Product Support
piggeej
Posts: 281
Registered: ‎03-27-2012
Message 2 of 5 (156 Views)

Re: Getting the Author of Item

04-20-2012 09:21 AM in reply to: rcoffey2

Rodney,

 

Finding the creator of an item within the workspace can be obtained one of two ways. The first way being the usage of the Change log, which is a built in tab, that anyone with the right permissions could see.

 

However, if I understand your question correctly you will want to use a behavior script that will use the argument of “ownerID” that will pull the information that you are looking for and place it with in a designated field within the item.

-----

 

Reference: http://wikihelp.autodesk.com/PLM_360/enu/Help/Help/0032-Administ32/0064-Scriptin64/0071-Scriptin71

Look under Objects on item Properties -> Descriptor (read- only)



Joe Piggee
Support Specialist
Product Support
Autodesk, Inc.

Member
rcoffey2
Posts: 4
Registered: ‎04-11-2012
Message 3 of 5 (147 Views)

Re: Getting the Author of Item

04-20-2012 12:01 PM in reply to: rcoffey2

These were the options I was looking at. The change log is great, but like to have it as a filed in the details. I was looking at it as an action scipt on item creation, but am having a little trouble generating the script from whats in that wiki. Is there any change you could provide a sample. Seems like this would be an awefully usefull library script. One that just fills in data based on values in the system. I know there is the one to pass properties with item creation sciprt, but all I am looking to do is fill this out, not create a new item.

 

So

 

If Author is null then populate Author with Created by or Onwer, I think either of these will wotk. If you could provide a sample for the code it would be greatly appreciated, I will add it to my library and use it for some other things I have been looking at.

 

Thanks,

Board Manager
broepke
Posts: 179
Registered: ‎01-24-2004
Message 4 of 5 (138 Views)

Re: Getting the Author of Item

04-22-2012 07:15 AM in reply to: rcoffey2

I've done this in the past really only for one reason that makes sense - when you want to add the "owner" into a field that can be used in the descriptor.  I used this on the "tasks" workspace in the past when I had a ton of tasks on Projects - makes the Gantt easier to read on an overview level.

 

Here is the code I used. (action script)

 

var usrName = "";


//Get the user's full name - "First Last"

var usr = Security.loadUser(userID);
usrName = usr.lastName + ", " + usr.firstName;


//check to see if the user names match, otherwise update it.

//Note - the "RESPONSIBLE" field in this script is a pick list to the

//"user, all" pick list.  This will ensure no typo's

if (usrName !== item.RESPONSIBLE){
//the conditional checks to make sure that it only write if the value

//has changed, otherwise skip it - good practices to avoid a messy

//change log.

item.OWNER = usrName;
}

 

Normall I'm not a fan of this type of workflow because you're essentially duplicating data.  However, it does the job and I have used it.

 

Keep in mind that to get this to work you have to fire the script.  I do it on the behavior for "modify".



Brian Roepke
Director of PLM & PDM
Autodesk, Inc.

Board Manager
broepke
Posts: 179
Registered: ‎01-24-2004
Message 5 of 5 (128 Views)

Re: Getting the Author of Item

04-23-2012 07:00 AM in reply to: broepke

Small error above - Change in the last line

 

item.OWNER = usrName;

 

to 

 

item.RESPONSIBLE= usrName;



Brian Roepke
Director of PLM & PDM
Autodesk, Inc.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post