item.workflowItem Scripting Query

item.workflowItem Scripting Query

Anonymous
Not applicable
1,488 Views
10 Replies
Message 1 of 11

item.workflowItem Scripting Query

Anonymous
Not applicable

Hi,

 

Is there any way to access the 'lifecycle' field of the affected items in a revisioning item in scripting (see attached image)? I want to be able to validate via scripting that the user has made a selection (i.e. either 'revise' or 'retire')

 

Thanks,

 

David.

0 Likes
Accepted solutions (1)
1,489 Views
10 Replies
Replies (10)
Message 2 of 11

broepke
Alumni
Alumni

Hi David,

 

This is totally be possible - I made a quick test to hack together to make sure it works - something like this:

 

While there is no logic here - drop it intoa  new conditional script and you can see the print statement will get you the name of the LC

 

var isOkay = false;

println(item.workflowItems[0].item.descriptor.dvi.lifecycleState.stateName);

returnValue(isOkay);

 

For reference - there is a link here that shows the properties to access the linked items.  Ater you get to the item you can traverse it just like you would a linking pick list or other similar related item.

 

http://wikihelp.autodesk.com/PLM_360/enu/Help/Help/0091-Develope91/0092-Server-S92/0099-Scriptin99#S...



Brian Roepke
Director, Analytics & Insights
0 Likes
Message 3 of 11

broepke
Alumni
Alumni

Ah..... Sorry - Misunderstood - Reading again I get your point - akin to making it a required field. 

 

I'll see if anyone else knows a way - I'm not familar with that... 



Brian Roepke
Director, Analytics & Insights
0 Likes
Message 4 of 11

Anonymous
Not applicable

Hi Brian,

 

Yes as you said - akin to making it a required field. I look forward to hearing the outcome of your enquiry.

 

David.

0 Likes
Message 5 of 11

Anonymous
Not applicable

David,

 

Following up on this, when an item is in a lifecycle it is already predefined as unreleased (on creation of the item).

 

So by using the script predefined by Brian,

One could create a Validation script that will check for the given state (revise or retire), or to check that the given state is not equal to unreleased ( this would be the easier way to go). This will in turn force alert the user that they must complete that required section. 

0 Likes
Message 6 of 11

Anonymous
Not applicable

Hi Joe,

 

Thanks for the reply. But I'm still a little unclear on this.

 

Its not the item lifecycle state that I need to check. I want to be able to check what lifecycle transition has been selected for items on the 'affected items' table. Please see the image I attached to an earlier post.

 

Perhaps I haven't picked you up correctly?

 

Thanks,

 

David.

0 Likes
Message 7 of 11

Anonymous
Not applicable

I also raised an Idea Station entry for this that might shed more light on it.

 

Idea Station entry

0 Likes
Message 8 of 11

Anonymous
Not applicable

David,

 

Ok I think i have narrowed down what you are asking about

 

Based on the picture shown, whatever the user inputs for that field, and then saves it. That is what the script will return. If nothing is selected then it will auto default to the last selection made, If it is a new item then it will default to unreleased.

0 Likes
Message 9 of 11

Anonymous
Not applicable

Hi Joe,

 

I did some testing on the scipt you provided. I think it returns the 'current' lifecycle state of the item in the affected items table. 

 

I completed the following steps;

 

1. Created a new revision-controlled item (item A)

2. I created a new revisioning item (item B)

3. I attached item A to the 'affected items' tab of item B

4. I ran the script you provided on item B. Result was 'Unreleased'

5. I changed the 'lifecycle' value in the affected items table for item A. 

6. I ran the same script again. Result was 'Unreleased'

 

Is there something that I'm missing here? The lifecycle of the item A wont change until item B reaches the 'managed state'.

 

Thanks,

 

David.

0 Likes
Message 10 of 11

Anonymous
Not applicable
Accepted solution

David,

 

Nope not missing a thing, I stand corrected (retested myself), I'll see to it as to support your submission to the IdeaStation Smiley Happy

Message 11 of 11

Anonymous
Not applicable

Thanks Joe.

0 Likes