Change Object type using API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Change Object type using API
Hi Everyone,
I need help in changing Object type using API.
I want to know if any method exists that can change the object type.
Regards
Sudeep
Solved! Go to Solution.
- Labels:
-
Other
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Prabhash,
During Migration, there were some parts migrated with wrong type. Hence i needed the API and i found it.
TypeHelper.setType((Persistable)partObj, TypeHelper.getTypeIdentifier("internal_name"));
PersistenceServerHelper.update(partObj);
partObj = (WTPart)PersistenceHelper.manager.refresh(partObj);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Sudeep, I have not come across any API , that can be used to do so. Let's wait what others have to say.
Just curious, what is your business case, that you are looking for such an API.
Kindly share, if you find anything related to this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Prabhash,
During Migration, there were some parts migrated with wrong type. Hence i needed the API and i found it.
TypeHelper.setType((Persistable)partObj, TypeHelper.getTypeIdentifier("internal_name"));
PersistenceServerHelper.update(partObj);
partObj = (WTPart)PersistenceHelper.manager.refresh(partObj);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi spai,
could you please provide me a import statement this two methods TypeHelper.setType(), TypeHelper.getTypeIdentifier();
It would me more helpful for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Do you need an API or is a utility that PTC has acceptable?
If the utility is acceptable, you can refer to this Knowledgebase Article
We've used this pretty successfully, we've also made some slight tweaks to the output SQL to add additional clauses to filter the objects to be changed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Stephen,
Good to know that there is a utility for this.
But i had to convert only set of parts whose numbers had to be read from a file and also update many custom attributes on conversion.
So i think using a API is a better option. This is the code i used.
TypeHelper.setType((Persistable)partObj, TypeHelper.getTypeIdentifier("internal_name"));
PersistenceServerHelper.update(partObj);
partObj = (WTPart)PersistenceHelper.manager.refresh(partObj);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Glad you found what you were looking for. We did end up customizing the SQL that the tool outputs to allow us to put in a set of object numbers to convert, but we did not need to touch any attributes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi, Please share the sql here if possible, I am not able to access that link.
