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 

Parents
  • 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.

  • 0 オフライン in reply to AngelaIp

    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 

  • 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

  • 0 オフライン in reply to Meismart

    Hi Martin

    Thanks for the response. Correct i can version manually and the file copies.

    What i did notice is if i put the version script on the pre server method on the transition it works,the file versions correctly (copying the word file ect) but the document does not move to the next life cycle step it stays on the current one.

    I have given ARAS-PLM permissions in the script aswell. I have updated it as per below, 

    Innovator inn = this.getInnovator();

    // Grant 'Aras PLM' permissions
    Aras.Server.Security.Identity plmIdentity = Aras.Server.Security.Identity.GetByName("Aras PLM");
    bool PermissionWasSet = Aras.Server.Security.Permissions.GrantIdentity(plmIdentity);

    try
    {
    // Version
    Item resItem = this.apply("version");
    resItem = resItem.apply("unlock");
    // Finish
    return resItem;
    }
    finally
    {
    // Revoke 'Aras PLM' permissions
    if (PermissionWasSet) Aras.Server.Security.Permissions.RevokeIdentity(plmIdentity);
    }

    The only issue i still have is that this does not move on to the next lifecycle step when i add it on the pre. 

    Wian 

  • 0 オフライン in reply to Meismart

    Hi Martin

    Its great news that I know its at least do able :D 

    If i do this manually it works correctly by copying the file ect. 

    I gave ARAS PLM full permissions on the document classification type and still the same issue, it versions but without the "attachment".

    If I put the method on the Pre transition it works but it stays within the initial work flow stage. Im not sure if im missing something in my script? 

    Regards

    Wian

  • Hi Wian,

    I can't find the exact code we used to do this, I think you will need to do the version of the item on the post transition, then reattach any attachments.

    Copy the relationships and set a new source_id.

    (also you should move "return resItem; to the finally statement).

    Many thanks,
    Martin

Reply Children