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.
Solved! Go to Solution.
Solved by jpiggee. Go to Solution.
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.
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...
Hi Brian,
Yes as you said - akin to making it a required field. I look forward to hearing the outcome of your enquiry.
David.
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.
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.
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.
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.
David,
Nope not missing a thing, I stand corrected (retested myself), I'll see to it as to support your submission to the IdeaStation