cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lock state in a Revisioning workspace and files checked out

Lock state in a Revisioning workspace and files checked out

Hello,

 

When we include some objects in the tab "Managed Items" of a Revisioning Workspace, the goal is to raise their lifecycle when we are in the state identified as the "Managed State". But, if you look at the workflow of a basic Change Order (see attachment), when we submit the Change Order from "Created" to "Final Review", normally, all the content must be locked as there is the 'lock state' on the state "Final Review".

But if in the "Created" state you have checked-out an attachment contained in the object that you have added on the DCO (in the "Managed Items" tab), you can submit the DCO to the state "Final Review" with this attachment checked-out.

Of course, if we approve the DCO, the person who has checked-out the attachment can do an "Undo Checkout" but it is not really the best practice I think.

 

Is it possible to block the submit on the DCO if there is an attachment checked-out in the affected objects? This thing can be improved in a next released as it is logic to work like this? I have tried to do a validation script between the states "Created" and "Final Review" but I don't know how I can see if a file is currently checked-out or not (nothing on scripting reference here).

 

Thanks,

Sylvain

4 Comments

 Hello @PLM-Sylvain.Bailly,

 

Thank you for taking time to contact Autodesk Forums and Support.   Based on quick review I believe a validation script could be implemented in transition however, I'll review item with the team for clarification.   Thank you

Hi @PLM-Sylvain.Bailly,

 

My colleagues did a review they have provided the following which may assist.

 

//Array used for storing any user messages that will be presented to the user
var messages = [];

//loads the complete object of the item's attachments into a variable
var attachmentList = item.attachments;

//First - conditionally check to see if there is at least one attachment.
if (attachmentList.length > 0){
for(var i=0; i<attachmentList.length; i++) {

//next, loop through all the attachments and see if any are checked out
if (attachmentList[i].checkOutUserID !== null){
messages.push("Please make sure that all attachments are checked-in.");
break;
}
}
}
else{

//if there isn't at least one, alert the user.
messages.push("You must have at least one attachment to place it in review.");
}

returnValue(messages);

PLM-Sylvain.Bailly
Collaborator

Hi James,

 

I have seen this formula in the scripting reference but I didn't test it because it was written that it returns the ID of the user who did the LAST or current checkout. And the validation script must just check the current and not the last at the same time or it will never returns the needed value. But I will test it and come back with the results soon.

 

item.attachments[i].checkOutUserID (string)
ID of the user who performed the last or current checkout of the specified attachment in the array

Thank you very much,

 

PLM-Sylvain.Bailly
Collaborator

Hi,

 

Your code is working with the function "attachmentList[k].checkOutUserID !== null".

I don't know if it is my English which is not good or the sentence in the Scripting reference which is not clear enough.

 

So now, if we have a change order and you want to check if all the affected objects have their attachment checked-in, we can use your script:

for(var j = 0; j < item.workflowItems.length; j++){
            var tempItem = item.workflowItems[j].item;
            var itemNumber = tempItem.NUMBER;
            var attachmentList = tempItem.attachments; // Loads the complete object of the item's attachments into a variable
            
            // Check to see if there is at least one attachment
            if(attachmentList.length > 0){
                for(var k = 0; k < attachmentList.length; k++){
                    // Loop through all the attachments and see if any are checked out
                    if(attachmentList[k].checkOutUserID !== null){
                        messages.push(itemNumber + ': please make sure that all attachments are checked-in.');
                    }
                }
            }
        }

Thank you very much,

Sylvain

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea  

Autodesk Design & Make Report