This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

APPLICATION - PRODUCT ENGINEERING - Error saving document

Brian - Wednesday, April 15, 2009 7:49 PM:

Hi All,

In am working in Innovator 9.02 trying to make a simple change to a Document.

The document is in Draft state. We have the Document Change workflow installed and so have the modified Document Lifecycle.

When I go to save the Document after making any change at all I get the following error:

Failed to update the Document with ID … : Failed to version the Document: Failed to version the Document: The method associated with the server event onAfterVersion failed: Error promoting affected Document: Internal Error: failed to get the transition to promote the Document from Draft to Draft (frozen)...
 
I have tried this with a number of documents and find the same problem with all of them.
This does not appear to be a permissions issue as the Super User gets the same error.
I have previously been able to save document changes in this instance of the database so this problem has come up out of the blue and without, as far as I am aware, any changes to lifecycles or workflows beyond the Document Change workflow installation which was installed before any of these documents were created.
 
I have another database instance which I use for testing which has basically the same setup and it is OK. I can change and save documents as normal.
 
I am not sure where the server event onAfterVersion is being called so I can't see what the code is trying to do.
 
Any help appreciated.
 
Thanks,
Brian (Confused in Canberra)
 


SamsAn - Thursday, April 16, 2009 8:57 AM:

Hi.

Document ItemType is versionable in standard solutions. So, if you lock and save Document instance then it is versioned. Thus onAfterVersion server-side event is executed (note: Document ItemType does not have any onAfterVersion event in 9.02, it seems you have a custom event). Based on the error message I conclude you have a custom onAfterVersion server event on Document ItemType. The event method tries to promote the instance from Draft to Draft (frozen) state. But no transitions found as reported. So, you should correct the method logic to have no contradictions.



Brian - Thursday, April 16, 2009 9:10 PM:

Hi SamsAn,

Turns out I am using 9.01 not 9.02. Not that I think that makes much difference.

I have looked at the onAfterVersion server event (yes there is one) and have to assume that it has been installed as part of the Document Change Solution.

The Document Lifecycle has been modifed by the Document Change Solution and does include a Draft (frozen) state.

The method code is fairly straight forward and doesn't seem to offer any contradictions.

Relevant code is

Dim docId As String = Me.getId()
Dim this_docGeneration As String = Me.getProperty("generation","")
Dim this_docState As String = Me.getProperty("state","")
Dim this_configId As String = Me.getProperty("config_id","")
 
If this_docState <> "" And (this_docState = "Draft" Or this_docState = "Preliminary") Then
 
  plmIdentity = Aras.Server.Security.Identity.GetByName("Aras PLM")
  PermissionWasSet = Aras.Server.Security.Permissions.GrantIdentity(plmIdentity)
 
  '''''''''''''''''''''''''''''''''''
  ' promote draft and preliminary documents to "Draft (frozen)
  tempItem = Me.newItem("Document","promoteItem")
  tempItem.setId(docId)
  tempItem.setAttribute ("version","0")
  tempItem.setProperty("state","Draft (frozen)")
  tempItem = tempItem.apply()
  If (tempItem.isError()) Then
    thisErr = innovator.newError("Error promoting affected Document: " & tempItem.getErrorDetail())
    Goto Freeze_old_Drafts_of_Doc_Return 'This is a clean up and return section
  End If
 
End If

What really has me confused is that I have another test environment with the same server side method which works just fine. I even have another document in draft in the system that is throwing up the errors that works just fine but if I create any new documents they fail with this error!!

Any other suggestions?

Thanks,

Brian.

 



RobMcAveney - Thursday, April 16, 2009 10:35 PM:

Hi Brian -

I'm not familiar with the Document Change community solution, but I can tell you what the error message means.  The method is trying to promote the Document from "Draft" state to "Draft (frozen)" state, but can't find a transition between those states.  I would start by going to Views->LifeCycle on the Document form to make sure that the Document is in the LifeCycle you expect and that there's an arrow from "Draft" to "Draft (frozen)".  If that looks okay, then go to the Life Cycle Map and make sure that transition is assigned to the Aras PLM identity.

Rob



SamsAn - Monday, April 20, 2009 11:09 AM:

Hi.

First, please ensure your Life Cycle Map has transitions from Draft and Preliminary state to Draft (frozen) state AND the transitions Role is Aras PLM Identity OR your user belongs to the identity assigned in Role.



Brian - Thursday, April 16, 2009 10:57 PM:

Hi Rob,

Thanks for the reply.

This is the DocumentItem.

This is the Document Lifecycle

 

This is the Document Instance I am trying to edit.

 

It all looks like it should be OK, and it is in the other instance of the database.

Thanks,

Brian.



Brian - Monday, April 20, 2009 7:39 PM:

Hi SamsAn,

As you can see from the earlier post with the images, the life cycle and transitions are as you describe.

What really surpises me is that creating the Document from a Part results in different behaviour than creating the Document directly from the TOC. Surely once the create document method is employed and the Document form is opened the internal behaviour should be the same regardless of where the Form was called from?

Brian.



RobMcAveney - Thursday, April 16, 2009 11:24 PM:

Brian -

Hmmmmm... everything you sent looks fine to me.  My next step would be to try debugging the method to see if any of the values looked odd.  Do you have Visual Studio or the CLR Debugger installed?  If so, you can set a breakpoint (System.Diagnostics.Debugger.Break()) at the beginning of the method and step through it.  If not, we'll have to get in touch with the author of the solution and see if he's ever seen this before.

Rob



Brian - Friday, April 17, 2009 1:24 AM:

Rob,

Just tried to debug using Visual Studio on a colleagues machine but it just hung. I guess I don't know how to connect the debugger up properly at this stage. Is there some trick to it or should I just be able to set a break point and it will fire up the debugger on its own?

Brian.



Brian - Sunday, April 19, 2009 11:44 PM:

Looking into this some more I have found that it is possible to create a document and edit it without getting the error if the document is created directly from the TOC and not from a Part. Also if, when the document is created from the Part AND the "Designated User" is filled in then I do not get the error.

Still a bit strange as I don't get this same behaviour from both of the database instances that I am testing with.

Since I have a viable work around now I will let this one drop.

Thanks for the pointers.

Brian.