Skip to main content
4-Participant
May 16, 2017
Question

If a user deletes a Content item from a Document by mistake...How can I add that same Content item (with the same id) back into that Document?

  • May 16, 2017
  • 2 replies
  • 6569 views

If a user deleted a Content item (Test Case) from a Document (Test Suite) by mistake...How can I add that same Content item (with the same id) back into that Document?

I can export the Test Suite "as of" a previous date to see the removed content (Test Cases) and relationships. How can I add those Test Cases back into the document...then re-establish relationships? 

We recently updated from 10.5 to 11.0...but have not yet enabled document/content versioning.

2 replies

1-Visitor
May 18, 2017

Hi John,

If we delete any content from document intentionally or non intentionally we can't create content on the same ID again because once i tried to delete a content but after deletion that id is not released by Integrity means it is still allocated. But if for ID creation there is some concept of DB or we can say there is some linkage with DATABASE then we can release it manually but as per my understanding it's not there just a blind guess.
And whenever we create a content it gives the next free ID in sequential order so for example if you delete a content of having ID 3 and ID 4,5 and 6 also exist in the system , so whenever you will create new content even after deletion of ID 3 it will allocate ID 7. 

Hope this helps.

Regards

Kapil Jain

jwoolard4-ParticipantAuthor
4-Participant
May 18, 2017

I know I cannot create a new content item with the same id. That is because the removed content item still exists in the PTC database with that id.

The Content->Delete menu just breaks the parental relationships to the content item (im removecontent)...rather than actually deleting it from the database (im deleteissue). You can still view the removed content item by entering the ID in the Item field in the GUI.

So the removed Test Case still exists with most all the data content..it is just no longer related to other items or associated to a parent. What I am looking to do is to re-establish the parental relationship broken by the Content->Delete (im removecontent).

I tried a few options in CLI (im movecontent, im insertsegment) but they all produced an error indicating the item was not associated to a parent.

I was able to do this to some degree using the CLI (im importcontent). The item id showed up when I viewed the Test Suite...but content was not displayed properly...and PTC still did not fully recognize it as content. The parental relationship was not properly re-established.

From a database perspective...I see no reason I should not be able to restore a parental relationship...broken by removing content. All the data is there...relationships just need to be re-established. PTC allows us to insert content from another document...why would it not allow us to insert orphaned content...previously removed from a document?

1-Visitor
May 23, 2017

Hi John,

One option is copy the content from historic view (by using view as of function). The downside is this will create a new content in your document with a new ID.

Second option is, using im editissue --import to change relationship fields. It's like we re-add the content item to Contains field of document item, and re-add shared item to References field of node item. You know we cannot edit Contain/References fields directly, so CLI command with --import parameter is required. You can get original relationship field value from item history.

The second option can help to "actually" roll back. But it require administrator to run that command, and should be very careful with --import command!!

Robben

1-Visitor
June 2, 2017