Forum Discussion

Wian_le_Roux's avatar
Wian_le_Roux
Ideator III
7 years ago
Solved

Versioning on lifecycle step

Hi Guys

I have a scenario where a user would like to keep record of a specific document type, namely pre-meeting and post-meeting to compare. 

We have manual versioning enabled on our documents itemtype, but the user would like this to happens automatically when the document is promoted to the next step in the document class lifecycle. 

I have created the linear life cycle assigned with the class, with permissions and created the following script,that runs on the post method transition. 

// Version
Innovator inn = this.getInnovator();
Item newItem = this.apply("version");

// Finish
return this;

This creates a new version of the document when i promote it to the lifecycle step, but it does not include the word file in the document view. Am i missing something in the script to pull the data from the previous version? 

Thanks in advance

Wian 

  • I found the code I am using (which maintains the document links).

    Item myThis = this.apply("version");
    if(myThis.fetchLockStatus()>0) {myThis.unlockItem();}

    return myThis;

8 Replies

  • What you describe should theoretically work. The Method PE_CreateNewRevision is a good reference for the “version” function. Maybe you can find anything useful there. 

    As far as I understood your post, the new item revision is created, but the word file is not copied from the previous version, right?
    Is your word file linked in an extra File relationship tab or directly as property in your main Itemtype? Are other properties copied correctly?

    Do you use other Methods, that may conflict with your current Methods? Maybe there is a second Method somewhere, that resets certain properties or relationship after a version event?

    Or to think it most simple – maybe your Form is just not updated to show the latest values? When you close your item after version and open it again, will you see the missing values? In this case, I might work when you return newItem instead of this.

    • Wian_le_Roux's avatar
      Wian_le_Roux
      Ideator III

      Hi Angela 

      Thank you for the response :) 

      Correct the Word file is not copied over to the new version of the file. Were using the default documents ItemType so the file is saved in the files relationship item. The rest of the form fields are carried over correctly. 

      Il]l go through that PE_CreateNewRevision method and see if i can crack something there. 

      Currently there is no other methods running on the lifecycle i was also hoping it was just the form that wasn't updating but unfortunate its not. 

      Wian 

      • Meismart's avatar
        Meismart
        Creator III

        Hi Wan,

        We use the same technique as described, which works for us.

        Have you checked:
        1) You can version the item manually- Does the file get copied across on a manual version?

        2) if this is being run on promote, is ARAS-PLM performing the promotion, does ARAS-PLM have permission to modify the relationship item?

        Many thanks,
        Martin